-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathBankSmallChange.java
More file actions
59 lines (59 loc) · 1.89 KB
/
Copy pathBankSmallChange.java
File metadata and controls
59 lines (59 loc) · 1.89 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package Exercise;
import java.util.Scanner;
public class BankSmallChange {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
int b1000=0,b500=0,b100=0,b50=0,b20=0,b10=0,b5=0,b2=0,b1=0,c50=0,c25=0;
double money;
System.out.print("ENTER Your Money : ");
money=input.nextDouble();
if(money>=1000){
b1000=(int)money/1000;
money-=(b1000*1000);
}if(money>=500){
b500=(int)money/500;
money-=(b500*500);
}if(money>=100){
b100=(int)money/100;
money-=(b100*100);
}if(money>=50){
b50=(int)money/50;
money-=(b50*50);
}if(money>=20){
b20=(int)money/20;
money-=(b20*20);
}if(money>=10){
b10=(int)money/10;
money-=(b10*10);
}if(money>=5){
b5=(int)money/5;
money-=(b5*5);
}if(money>=2){
b2=(int)money/2;
money-=(b2*2);
}if(money>=1){
b1=(int)money/1;
money-=(b1*1);
}
System.out.println("B1000= "+b1000);
System.out.println("B500= "+b500);
System.out.println("B100= "+b100);
System.out.println("B50= "+b50);
System.out.println("B20= "+b20);
System.out.println("B10= "+b10);
System.out.println("B5= "+b5);
System.out.println("B2= "+b2);
System.out.println("B1= "+b1);
money=money*100;
System.out.println((int)money);
if((int)money==75){
System.out.println("C50= 1\nC25= 1");
}else if((int)money==50){
System.out.println("C50= 1");
}else if((int)money==25){
System.out.println("C25= 1");
}else{
System.out.println("Stang Cannot Change.");
}
}
}