GeekInterview.com
Series: Subject: Topic:
Question: 18 of 587

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!!
Asked by: cguyc | Member Since Jul-2012 | Asked on: Jul 20th, 2012

View all questions by cguyc

Showing Answers 1 - 1 of 1 Answers
Bincy Roy

Answered On : 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. }

  
Login to rate this answer.

Give your answer:

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

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.