-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathc1039.java
More file actions
32 lines (24 loc) ยท 800 Bytes
/
Copy pathc1039.java
File metadata and controls
32 lines (24 loc) ยท 800 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package codeup;
import java.util.Scanner;
public class c1039 {
public static void main(String[] args){
Scanner sc = new Scanner(System.in); // Scanner ๊ฐ์ฒด ์์ฑ
// ๋ฒ์ : -2147483648 ~ -2147483648
System.out.print("์ฒซ๋ฒ์งธ ์ ์ ์
๋ ฅ: ");
long num1 = sc.nextLong();
long num2 = 0;
if( num1 < -2147483648L || num1 > 2147483648L ) { // num1์ด ๋ฒ์ ๋ฐ
System.out.println("๋ฒ์ ์์ ์ ์๋ฅผ ์
๋ ฅํด์ฃผ์ธ์.");
}else{ // num1์ด ๋ฒ์ ๋ด
System.out.print("๋๋ฒ์งธ ์ ์ ์
๋ ฅ: ");
num2 = sc.nextLong();
if( num2 < -2147483648L || num2 > 2147483648L ) { // num2์ด ๋ฒ์ ๋ฐ
System.out.println("๋ฒ์ ์์ ์ ์๋ฅผ ์
๋ ฅํด์ฃผ์ธ์.");
}else{
sc.close();
long sum = num1 + num2;
System.out.println(sum);
}
}
}
}