Friday, October 30, 2015

C++ PROGRAM TO COUNT DIFFERENT NUMBERS OF CURRENCY NOTES AND COINS.


#include<iostream.h>
void main()
{
int m,kh,hk,k,h,kk,hh,kp,hr;
cout<<"\tEnter the amount: ";
cin>>m;
cout<<"\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^";
kh=m/500;
hk=(m-(500*kh))/100;
k=(m-(500*kh)-(100*hk))/50;
h=(m-(500*kh)-(100*hk)-(50*k))/20;
kk=(m-(500*kh)-(100*hk)-(50*k)-(20*h))/10;
hh=(m-(500*kh)-(100*hk)-(50*k)-(20*h)-(10*kk))/5;
kp=(m-(500*kh)-(100*hk)-(50*k)-(20*h)-(10*kk)-(5*hh))/2;
hr=(m-(500*kh)-(100*hk)-(50*k)-(20*h)-(10*kk)-(5*hh)-(2*kp))/1;
cout<<"\n\n\tNumber of Rs.500 notes: "<<kh;
cout<<"\n\n\tNumber of Rs.100 notes: "<<hk;
cout<<"\n\n\tNumber of Rs.50 notes: "<<k;
cout<<"\n\n\tNumber of Rs.20 notes: "<<h;
cout<<"\n\n\tNumber of Rs.10 notes: "<<kk;
cout<<"\n\n\tNumber of Rs.5 notes: "<<hh;
cout<<"\n\n\tNumber of Rs.2 coins: "<<kp;
cout<<"\n\n\tNumber of Re.1 coins: "<<hr;
}

Click to download Code  
Click to download Program 

Pages