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 / aruna

The above program works gud. But I have small suggestion.

bill_count[i] = (val>=5?val/bill[i]:val);

This val >=5 will be executed every time though it is not
needed. Simpley we can give Quotient value in bill_count[i].
ie
bill_count[i] = val/bill[i];

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is c++ manipulator?

671


What is abstraction in c++?

812


Distinguish between new and malloc and delete and free().

690


What is the c++ programming language used for?

696


Explain polymorphism?

721






What is the basic concept of c++?

687


What are the differences between java and c++?

641


What is implicit conversion/coercion in c++?

835


What is virtual destructor ans explain its use?

749


Write a single instruction that will store an EVEN random integer between 54 and 212 inclusive in the variable myran. (NOTE only generate EVEN random numbers)

1624


Can we change the basic meaning of an operator in c++?

777


Describe public access specifiers?

714


Why is it necessary to use a reference in the argument to the copy constructor?

753


Define basic type of variable used for a different condition in C++?

791


What is the oldest programming language?

696