-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcurrency.txt
More file actions
84 lines (80 loc) · 1.77 KB
/
currency.txt
File metadata and controls
84 lines (80 loc) · 1.77 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*java prg to print how many indian currency notes is required to get n amount of rupees*/
import java.util.Scanner;
class Currency
{
public static void main(String[] args)
{
Scanner s=new Scanner(System.in);
System.out.println("enter amount");
int amount=s.nextInt();
int count=0;
if(amount>=2000)
{
int tt=amount/2000;
count=count+tt;
System.out.println(tt+"----(2000) rs note");
amount=amount%2000;
}
if(amount>=500)
{
int tt=amount/500;
count=count+tt;
System.out.println(tt+"----(500) rs note");
amount=amount%500;
}
if(amount>=200)
{
int tt=amount/200;
count=count+tt;
System.out.println(tt+"----(200) rs note");
amount=amount%200;
}
if(amount>=100)
{
int tt=amount/100;
count=count+tt;
System.out.println(tt+"----(100) rs note");
amount=amount%100;
}
if(amount>=50)
{
int tt=amount/50;
count=count+tt;
System.out.println(tt+"----(50) rs note");
amount=amount%50;
}
if(amount>=20)
{
int tt=amount/20;
count=count+tt;
System.out.println(tt+"----(20) rs note");
amount=amount%20;
}
if(amount>=10)
{
int tt=amount/10;
count=count+tt;
System.out.println(tt+"----(10) rs note");
amount=amount%10;
}
if(amount>=5)
{
int tt=amount/5;
count=count+tt;
System.out.println(tt+"----(5) rs note");
amount=amount%5;
}
System.out.println("******************total ["+count+"] no of notes");
count=0;
if(amount>=2)
{
int tt=amount/2;
count=count+tt;
System.out.println(tt+"----(2) rs coin");
amount=amount%2;
}
System.out.println(amount+"----(1) rs coin");
count=count+amount;
System.out.println("******************total ["+count+"] no of coins");
}
}