forked from Pavan-Kamthane/C_langauege_
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNote Exchange
60 lines (57 loc) · 1.14 KB
/
Note Exchange
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
#include<stdio.h>
int main()
{
int amount,n500,n200,n100,n50,n20,n10,n5,n1;
n500=n200=n100=n50=n20=n10=n5=n1=0;
printf("Enter your amount : ");
scanf("%d",&amount);
if(amount>=500)
{
n500 = amount/500;
amount -= n500*500;
}
else if(amount>=200)
{
n200 = amount/200;
amount -= n200*200;
}
else if(amount>=100)
{
n100 = amount/100;
amount -= n100*100;
}
else if(amount>=50)
{
n50 = amount/500;
amount -= n50*50;
}
else if(amount>=20)
{
n20 = amount/20;
amount -= n20*20;
}
else if(amount>=10)
{
n10 = amount/10;
amount -= n10*10;
}
else if(amount>=5)
{
n5 = amount/5;
amount -= n5*5;
}
else
{
n1 = amount/1;
amount -= n1*1;
}
printf("Total notes = \n");
printf("500 :- %d \n",n500);
printf("200 :- %d \n",n200);
printf("100 :- %d \n",n100);
printf("50 :- %d \n",n50);
printf("20 :- %d \n",n20);
printf("10 :- %d \n",n10);
printf("5 :- %d \n",n5);
printf("1 :- %d \n",n1);
}