File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ package codeup ;
2
+
3
+ import java .util .Scanner ;
4
+
5
+ public class c1039 {
6
+ public static void main (String [] args ){
7
+
8
+ Scanner sc = new Scanner (System .in ); // Scanner ๊ฐ์ฒด ์์ฑ
9
+
10
+ // ๋ฒ์ : -2147483648 ~ -2147483648
11
+ System .out .print ("์ฒซ๋ฒ์งธ ์ ์ ์
๋ ฅ: " );
12
+ long num1 = sc .nextLong ();
13
+ long num2 = 0 ;
14
+
15
+ if ( num1 < -2147483648L || num1 > 2147483648L ) { // num1์ด ๋ฒ์ ๋ฐ
16
+ System .out .println ("๋ฒ์ ์์ ์ ์๋ฅผ ์
๋ ฅํด์ฃผ์ธ์." );
17
+
18
+ }else { // num1์ด ๋ฒ์ ๋ด
19
+ System .out .print ("๋๋ฒ์งธ ์ ์ ์
๋ ฅ: " );
20
+ num2 = sc .nextLong ();
21
+
22
+ if ( num2 < -2147483648L || num2 > 2147483648L ) { // num2์ด ๋ฒ์ ๋ฐ
23
+ System .out .println ("๋ฒ์ ์์ ์ ์๋ฅผ ์
๋ ฅํด์ฃผ์ธ์." );
24
+
25
+ }else {
26
+ sc .close ();
27
+ long sum = num1 + num2 ;
28
+ System .out .println (sum );
29
+ }
30
+ }
31
+ }
32
+ }
You canโt perform that action at this time.
0 commit comments