| 1. |
Write a program that displays an amount in rupees in terms of notes of different dominations. Eg. Rs. 2782 is displayed as :Rs. 2000 notes: 1Rs. 500 notes : 1Rs. 100 notes: 2Rs. 50 notes : 1Rs. 20 notes : 1Rs. 10 notes : 1Rs. 5 notes : 0Rs. 2 notes : 1Rs. 1 notes : 0 |
Answer» Language:Python. Program:amount = INT(input("Enter a number : ")) note2000 = note500 = note100 = note50 = note20 = note10 = note5 = note2 = note1 = 0; if amount >= 2000: note2000 = int(amount/2000) amount = amount - (note2000*2000) if amount >= 500: note500 = int(amount/500) amount = amount - (note500*500) if amount >= 100: note100 = int(amount/100) amount = amount - (note100*100) if amount >= 50: note50 = int(amount/50) amount = amount - (note50*50) if amount >= 20: note20 = int(amount/20) amount = amount - (note20*20) if amount >= 10: note10 = int(amount/10) amount = amount - (note10*10) if amount >= 5: note5 = int(amount/5) amount = amount - (note5*5) if amount >= 2: note2 = int(amount /2) amount = amount - (note2*2) if amount >= 1: note1 = amount print("2000 notes = ",note2000) print("500 notes = ", note500); print("100 notes = ", note100); print("50 notes = ", note50); print("20 notes = ", note20); print("10 notes = ", note10); print("5 coins= ", note5); print("2 coins= ", note2); print("1 coins = ", note1); OutputEnter a number : 2782 2000 notes = 1 500 notes = 1 100 notes = 2 50 notes = 1 20 notes = 1 10 notes = 1 5 coins= 0 2 coins= 1 1 coins= 0 ---Hope this helps you |
|