Tuesday, November 23, 2010

Program to Accept an amount and print its Rupee Denomination

includes iostream.h and conio.h

void main()
{
int n, d;
clrscr();

cout << "Enter an Amount : ";
cin >> n;

d=n/1000;
cout << "1000 = " << d << endl;

n=n%1000;
d=n/500;
cout << "500 = " << d << endl;

n=n%500;
d=n/100;
cout << "100 = " << d << endl;

n=n%100;
d=n/50;
cout << "50 = " << d << endl;

n=n%50;
d=n/20;
cout << "20 = " << d << endl;

n=n%20;
d=n/10;
cout << "10 = " << d << endl;

n=n%10;
d=n/5;
cout << "5 = " << d << endl;

n=n%5;
d=n/2;
cout << "2 = " << d << endl;

n=n%2;
d=n/1;
cout << "1 = " << d << endl;

getch();
}

Labels:

1 Comments:

Blogger kalishmmrhss said...

good job sir

April 19, 2013 at 5:45 AM  

Post a Comment

Subscribe to Post Comments [Atom]

<< Home