Skip to content

Commit 523f0f6

Browse files
authored
src
1 parent 80df3a9 commit 523f0f6

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

โ€Žsrc/codeup100/c1042.java

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import java.util.Scanner;
2+
3+
public class c1042 {
4+
public static void main(String[] args) {
5+
Scanner sc = new Scanner(System.in);
6+
int a = sc.nextInt();
7+
int b = sc.nextInt();
8+
9+
System.out.printf("%d", a/b);
10+
}
11+
}
12+
13+
14+
// ์ด๋ ‡๊ฒŒ ์ ‘๊ทผํ–ˆ์œผ๋‚˜ ๋„ˆ๋ฌด ์ข‹์€ OpenSource๋ฅผ ๋ฐœ๊ฒฌํ•ด ์ ์–ด๋ณธ๋‹ค
15+
๐Ÿ’ก๐Ÿ’ก๐Ÿ’ก๐Ÿ’ก๐Ÿ’ก๐Ÿ’ก๐Ÿ’ก
16+
17+
import java.util.Scanner;
18+
19+
public class c1042 {
20+
public static void main(String[] args) {
21+
Scanner sc = new Scanner(System.in);
22+
boolean run = true; // while๋ฌธ์„ ์ œ์–ดํ•˜๊ธฐ ์œ„ํ•œ ๋ณ€์ˆ˜
23+
24+
// ๋ฒ”์œ„ ๋ฐ–์˜ ๊ฐ’์„ ์ž…๋ ฅํ–ˆ์„ ๋•Œ๋ฅผ ์œ„ํ•œ ์˜ˆ์™ธ์ฒ˜๋ฆฌ
25+
try {
26+
// ( int ๋ฒ”์œ„ : -214783648 ~ 214783648 )
27+
while (run) { // ๋ฒ”์œ„ ๋‚ด์˜ ๊ฐ’ ์ž…๋ ฅ
28+
System.out.println("์ฒซ ๋ฒˆ์งธ ์ •์ˆ˜ ์ž…๋ ฅ : " );
29+
int num1 = sc.nextInt();
30+
31+
System.out.println("๋‘ ๋ฒˆ์งธ ์ •์ˆ˜ ์ž…๋ ฅ : " );
32+
int num2 = sc.nextInt();
33+
34+
if ( num2 == 0 ) {
35+
System.out.println("๋‚˜๋ˆ„๋Š” ์ˆ˜๊ฐ€ 0์ด ๋  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.");
36+
// while๋ฌธ ๋ฐ˜๋ณต
37+
38+
} else { // num2 != 0
39+
int result = num1 / num2;
40+
System.out.println(result);
41+
run = false; // while๋ฌธ ์ข…๋ฃŒ
42+
}
43+
}
44+
} catch (Exception e) {
45+
System.err.println("๋ฒ”์œ„ ๋ฐ–์˜ ์ •์ˆ˜๋ฅผ ์ž…๋ ฅํ•˜์…จ์Šต๋‹ˆ๋‹ค.");
46+
}
47+
sc.close();
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