1-2. A+B

YOONIVERSEยท2023๋…„ 10์›” 13์ผ
0

๋ฐฑ์ค€

๋ชฉ๋ก ๋ณด๊ธฐ
2/13

๐Ÿ”” java

๋‹จ๊ณ„๋ณ„ ๋ฌธ์ œ

๋ฌธ์ œ 1-2. 1000

๋‘ ์ •์ˆ˜ A์™€ B๋ฅผ ์ž…๋ ฅ๋ฐ›์€ ๋‹ค์Œ, A+B๋ฅผ ์ถœ๋ ฅํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค.

๋‚ด๊ฐ€ ํ‘ผ ๋‹ต

import java.util.*;

class Main{
	public static void main(String[] args) {
    	Scanner in = new Scanner(System.in);
        
        int A = in.nextInt();
        int B = in.nextInt();
        
        System.out.println(A+B);
    }
}

๐Ÿ”Ž ๊ณต๋ถ€


in.nextByte();				// byteํ˜• ์ž…๋ ฅ ๋ฐ ๋ฆฌํ„ด
in.nextShort();				// shortํ˜• ์ž…๋ ฅ ๋ฐ ๋ฆฌํ„ด
in.nextInt();				// intํ˜• ์ž…๋ ฅ ๋ฐ ๋ฆฌํ„ด
in.nextLong();				// longํ˜• ์ž…๋ ฅ ๋ฐ ๋ฆฌํ„ด

in.nextFloat();				// floatํ˜• ์ž…๋ ฅ ๋ฐ ๋ฆฌํ„ด
in.nextDouble();			// doubleํ˜• ์ž…๋ ฅ ๋ฐ ๋ฆฌํ„ด

in.nextBoolean();			// booleanํ˜• ์ž…๋ ฅ ๋ฐ ๋ฆฌํ„ด

in.next();					// stringํ˜• ์ž…๋ ฅ ๋ฐ ๋ฆฌํ„ด(๊ณต๋ฐฑ๊ธฐ์ค€์œผ๋กœ ํ•œ๋‹จ์–ด๋ฅผ ์ฝ์Œ)
in.nextLine();				// stringํ˜• ์ž…๋ ฅ ๋ฐ ๋ฆฌํ„ด(๊ฐœํ–‰์„ ๊ธฐ์ค€์œผ๋กœ ํ•œ ์ค„์„ ์ฝ์Œ)
profile
์Šคํ…์ด ๊ผฌ์ด๋ฉด ๊ทธ๊ฒƒ์ด ๋ฐ”๋กœ ํƒฑ๊ณ  ๐Ÿ’ƒ

0๊ฐœ์˜ ๋Œ“๊ธ€