Accept an amount in rupees (indian currency ) from the user...

....and find the minimum number of notes to form that amount.
The denominations are 500,100,50,20,10,5,2,1 Rupee.
using any loop!!

Questions by cguyc

Showing Answers 1 - 3 of 3 Answers

Bincy Roy

  • Jul 30th, 2012
 

Code
  1. #include<stdio.h>

  2. int main(){

  3.  

  4. int amount,no_hun,no_fifty,no_ten,no_five,no_two,no_one,total_notes;

  5.  


  6. Enter the amount: ");

  7. scanf("%d",&amount);

  8.  

  9. no_hun=amount/100;

  10. amount=amount%100;

  11.  

  12. no_fifty=amount/50;

  13. amount=amount%50;

  14.  

  15. no_ten=amount/10;

  16. amount=amount%10;

  17.  

  18. no_five=amount/5;

  19. amount=amount%5;

  20.  

  21. no_two=amount/2;

  22. amount=amount%2;

  23.  

  24. no_one=amount/1;

  25. amount=amount%1;

  26.  

  27. total_notes=no_hun + no_fifty + no_ten + no_five + no_two + no_one;

  28.  

  29. printf("Smallest No of notes = %d",total_notes);

  30.  

  31. return 0;

  32. }

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions