๐Ÿ•ธ Algorithm/๐Ÿ•ธ ๋ฐฑ์ค€ BaekJoon

[๋ฐฑ์ค€][java][1330][๋‘ ์ˆ˜ ๋น„๊ตํ•˜๊ธฐ]

๋‰ด์ด NUEY 2023. 9. 24. 19:57
๋ฐ˜์‘ํ˜•

import java.util.Scanner;

// 1330	๋‘ ์ˆ˜ ๋น„๊ตํ•˜๊ธฐ
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int inputA = sc.nextInt();
		int inputB = sc.nextInt();
		
		System.out.println(inputA > inputB ? ">" : (inputA < inputB ? "<" : "=="));
		
		sc.close();
	}
}

 

  • Scnner์˜ nextInt() ํ•จ์ˆ˜๋Š” ๊ณต๋ฐฑ์„ ์ฒ˜๋ฆฌํ•˜์ง€ ๋ชปํ•˜๊ธฐ์— ๋„์›Œ์“ฐ๊ธฐ๋ฅผ ํ•˜๋ฉด ๋‹ค๋ฅธ ๋ณ€์ˆ˜์— ๊ฐ’์ด ๋Œ€์ž…๋˜์—ˆ์Šต๋‹ˆ๋‹ค
  • if() else if() else() ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋Œ€์‹  ๊ฐ„๋‹จํ•˜๊ฒŒ ์‚ผํ•ญ์—ฐ์‚ฐ์ž ? : ๋ฅผ ์ด์šฉํ•˜์—ฌ์„œ ์ถœ๋ ฅํ–ˆ์Šต๋‹ˆ๋‹ค

 

 

 

 

 

๋ฐ˜์‘ํ˜•