File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
You canโt perform that action at this time.
0 commit comments