- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNotes.java
More file actions
Latest commit
66 lines (62 loc) · 1.32 KB
/
Copy pathNotes.java
File metadata and controls
66 lines (62 loc) · 1.32 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
60
61
62
63
64
65
66
importjava.util.Scanner;
classFirst
{
publicstaticvoidmain(Stringar[])
{
Scannero1=newScanner(System.in);
intamount;
intnote500,note100,note50,note20,note10,note5;
intnote2,note1;
note500=note100=note50=note20=note10=note5=note2 =note1=0;
System.out.print("Enter amount: ");
amount=o1.nextInt();
if(amount>=500)
{
note500=amount/500;
amount-=note500*500;
}
if(amount>=100)
{
note100=amount/100;
amount-=note100*100;
}
if(amount>=50)
{
note50=amount/50;
amount-=note50*50;
}
if(amount>=20)
{
note20=amount/20;
amount-=note20*20;
}
if(amount>=10)
{
note10=amount/10;
amount-=note10*10;
}
if(amount>=5)
{
note5=amount/5;
amount-=note5*5;
}
if(amount>=2)
{
note2=amount/2;
amount-=note2*2;
}
if(amount>=1)
{
note1=amount;
}
System.out.println("Total number of notes =");
System.out.println("500="+note500);
System.out.println("100="+note100);
System.out.println("50="+note50);
System.out.println("20="+note20);
System.out.println("10="+note10);
System.out.println("5="+note5);
System.out.println("2="+note2);
System.out.println("1="+note1);
}
}