-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEX09.java
More file actions
32 lines (28 loc) · 974 Bytes
/
Copy pathEX09.java
File metadata and controls
32 lines (28 loc) · 974 Bytes
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
package Ex_Collection;
import java.util.Scanner;
public class EX09 {
public static void main(String[]args){
int a, b, c, d, e, f;
System.out.printf("## 교환할 돈은 ? ");
Scanner s = new Scanner(System.in);
a = s.nextInt();
b = a / 500;
f = a % 500;
c = f / 100; /*2회차*/
f = f % 100;
d = f / 50;
f = f % 50;
e = f / 10;
f = f % 10;
/*b = a / 500;
c = (a - (b*500)) / 100;
d = (a - (b*500)-(c*100)) / 50; 1회차
e = (a - (b*500)-(c*100)-(d*50)) / 10;
f = (a - (b*500)-(c*100)-(d*50)-(e*10)) / 1;*/
System.out.printf("오백원짜리 ==> %d 개\n",b);
System.out.printf("백원짜리 ==> %d 개\n", c);
System.out.printf("오십원짜리 ==> %d 개\n", d);
System.out.printf("십원짜리 ==> %d 개\n", e);
System.out.printf("바꾸지 못한 잔돈 ==> %d 개\n", f);
}
}