Computer Science, asked by shivang201206yadav, 5 hours ago

Write a program that displays an amount in rupees in terms of notes of different denominations e.g, amount 1782 is displayed as:
Rs 1000 notes:1
Rs 500 notes: 1
Rs 100 notes:2
Rs 50 notes: 1
Rs 20 notes:1
Rs 10 notes: 1
Rs 5 notes:0
Rs 2 notes: 1
Rs 1 notes:0​

Answers

Answered by vl19981994
2

Answer:

language -- python

Explanation:

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);

Output

Enter 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

I hope it's helpful for you

Answered by Shivu516
0

This program is in Java

import java.util.Scanner;

public class MoneyDenominator {

   public static void main(String [] args){

       //Taking input from the user

       Scanner sc = new Scanner(System.in);

       System.out.print("Enter the amount: ");

       int amount = sc.nextInt();

       //Counting notes

       int note1000 = amount / 1000;

       amount = amount % 1000;

       int note500 = amount / 500;

       amount = amount % 500;

       int note100 = amount / 100;

       amount = amount % 100;

       int note50 = amount / 50;

       amount = amount % 50;

       int note20 = amount / 20;

       amount = amount % 20;

       int note10 = amount / 10;

       amount = amount % 10;

       int note5 = amount / 5;

       amount = amount % 5;

       int note2 = amount / 2;

       amount = amount % 2;

       int note1 = amount;

       //Printing the output

       System.out.println("The denominations are as follows");

       System.out.println("Rs 1000: " + note1000);

       System.out.println("Rs 500: " + note500);

       System.out.println("Rs 100: " + note100);

       System.out.println("Rs 50: " + note50);

       System.out.println("Rs 20: " + note20);

       System.out.println("Rs 10: " + note10);

       System.out.println("Rs 5: " + note5);

       System.out.println("Rs 2: " + note2);

       System.out.println("Rs 1: " + note1);

   }

}

Output:

Enter the amount: 8987

The denominations are as follows

Rs 2000: 4

Rs 500: 1

Rs 100: 4

Rs 50: 1

Rs 20: 1

Rs 10: 1

Rs 5: 1

Rs 2: 1

Rs 1: 0

Similar questions