Skip to content

Commit bd076ae

Browse files
authored
src
1 parent 1d4f97b commit bd076ae

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

โ€Žsrc/codeup100/c1038.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,39 @@ public class c1038 {
1111
System.out.printf("%.0f", a+b);
1212
}
1313
}
14+
15+
// ์ด๋ ‡๊ฒŒ ์ ‘๊ทผํ–ˆ์œผ๋‚˜ ๋„ˆ๋ฌด ์ข‹์€ OpenSource๋ฅผ ๋ฐœ๊ฒฌํ•ด ์ ์–ด๋ณธ๋‹ค
16+
17+
๐Ÿ’ก๐Ÿ’ก
18+
package codeup;
19+
20+
import java.util.Scanner;
21+
22+
public class c1038 {
23+
Scanner sc = new Scanner(System.in); // Scanner ๊ฐ์ฒด ์ƒ์„ฑ
24+
25+
// ๋ฒ”์œ„ : -1073741824 ~ 1073741824
26+
System.out.print("์ฒซ๋ฒˆ์งธ ์ •์ˆ˜ ์ž…๋ ฅ: ");
27+
long num1 = sc.nextLong();
28+
long num2 = 0;
29+
30+
if( num1 < -1073741824 || num1 > 1073741824 ) { // num1์ด ๋ฒ”์œ„ ๋ฐ–
31+
System.out.println("๋ฒ”์œ„ ์•ˆ์˜ ์ •์ˆ˜๋ฅผ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”.");
32+
33+
}else{ // num1์ด ๋ฒ”์œ„ ๋‚ด
34+
System.out.print("๋‘๋ฒˆ์งธ ์ •์ˆ˜ ์ž…๋ ฅ: ");
35+
num2 = sc.nextLong();
36+
37+
if( num2 < -1073741824 || num2 > 1073741824 ) { // num2์ด ๋ฒ”์œ„ ๋ฐ–
38+
System.out.println("๋ฒ”์œ„ ์•ˆ์˜ ์ •์ˆ˜๋ฅผ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”.");
39+
40+
}else{
41+
sc.close();
42+
long sum = num1 + num2;
43+
System.out.println(sum);
44+
}
45+
}
46+
}
47+
}
48+
49+

0 commit comments

Comments
ย (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy