write a program that displays an amount in rupees in terms of notes of different denominators example 8987 you can use very notes from 1 to 2000
Answers
Answer:
Gajafjajan Jaffagjud is not even that Hall: Brother Hotstar
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 note2000 = amount / 2000;
amount = amount % 2000;
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 2000: " + note2000);
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