-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathc1038.java
More file actions
52 lines (36 loc) ยท 1.12 KB
/
Copy pathc1038.java
File metadata and controls
52 lines (36 loc) ยท 1.12 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package codeup;
import java.util.Scanner;
public class c1038 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
double a = sc.nextInt();
double b = sc.nextInt();
System.out.printf("%.0f", a+b);
}
}
// ์ด๋ ๊ฒ ์ ๊ทผํ์ผ๋ ๋๋ฌด ์ข์ OpenSource๋ฅผ ๋ฐ๊ฒฌํด ์ ์ด๋ณธ๋ค
๐ก๐ก
package codeup;
import java.util.Scanner;
public class c1038 {
public static void main(String[] args){
Scanner sc = new Scanner(System.in); // Scanner ๊ฐ์ฒด ์์ฑ
// ๋ฒ์ : -1073741824 ~ 1073741824
System.out.print("์ฒซ๋ฒ์งธ ์ ์ ์
๋ ฅ: ");
long num1 = sc.nextLong();
long num2 = 0;
if( num1 < -1073741824 || num1 > 1073741824 ) { // num1์ด ๋ฒ์ ๋ฐ
System.out.println("๋ฒ์ ์์ ์ ์๋ฅผ ์
๋ ฅํด์ฃผ์ธ์.");
}else{ // num1์ด ๋ฒ์ ๋ด
System.out.print("๋๋ฒ์งธ ์ ์ ์
๋ ฅ: ");
num2 = sc.nextLong();
if( num2 < -1073741824 || num2 > 1073741824 ) { // num2์ด ๋ฒ์ ๋ฐ
System.out.println("๋ฒ์ ์์ ์ ์๋ฅผ ์
๋ ฅํด์ฃผ์ธ์.");
}else{
sc.close();
long sum = num1 + num2;
System.out.println(sum);
}
}
}
}