Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

pls help..

paper bills.. 1000, 500, 100, 50, 20, 10, 5, 1..

create a program that will count all the paper bills in
the number being input..

example:
enter a number: 3886

there is/are:

3 ->1000
1 ->500
3 ->100
1 ->50
1 ->20
1 ->10
1 ->5
1 ->1

example2:
enter a number: 728

there is/are:

0 ->1000
1 ->500
2 ->100
0 ->50
1 ->20
0 ->10
1 ->5
3 ->1

Answer Posted / anand

nt main()
{
int number,count;
int currency[] = {1000, 500,100,50, 20, 10,5, 1};
cout<<"enter the number";
cin>>number;
for(int i=0; i<8;++i)
{
count = 0;
while(number >= currency[i])
{
number -= currency[i];
++count;
}
cout<<count<<"---"<<currency[i]<<"notes"<<endl;
}

getchar();
cout<<endl;

return 0;
}

Is This Answer Correct ?    4 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you mean by vtable and vptr in c++?

988


Write about the local class and mention its use?

1015


What is the difference between #import and #include?

990


What is a loop? What are different types of loops in c++?

1059


What is static in c++?

1006


What are the different types of comments allowed in c++?

935


What is lvalue?

1131


Explain one method to process an entire string as one unit?

1508


What is the difference between C and CPP?

1099


What is polymorphism and its type in c++?

1015


How do you decide which integer type to use?

948


What does extern mean in a function declaration in c++?

1154


What is a flag in c++?

1010


What is unary operator? List out the different operators involved in the unary operator.

939


What is the difference between structure and class?

1159