25/02/2023

Denomination Program in Java | 2000, 500, 100, 50, 20, 10, 5, 2, 1

write the java statements to input the amount from the user and print a minimum number of notes 2 (rs. 2000, 500, 100, 50, 20, 10, 5, 2, 1) required for the amount. Program for displaying the Denominations of an Amount or Money Change Breakdown or Java Program For Denomination of an Amount Using While Loop or Finding a total number of ways to make change using a given set of coins or java currency denominations or java program to display the currency denomination of a given amount or Write A Java Program To Find Denomination Needed for A Given Amount Along With The Total Number of Notes.

Denomination Program in Java

Generally, Notes used in banks are given below in descending Order. It is dependent on country wise there is some country Denomination. Below is the Indian and USA currency as you know after 8 November 1000 Rs. Ban in India Cause Black Money, We Thank Our Prime Minister Mr Narendra Damodardas Modi ( Man of action ) for such a biggest action.

( Before 8 Nov. 2016 )Present Day)Present Day )
INDIA ( Rupees )USA ( Dollar ) INDIA ( Rupees )
10001002000
50050500
10020200
5010100
20550
10220
5110
25
12
1

The Logic Behind we have to divide the money by Above Money is let's take an example Suppose money is 16108 then follow the Step We are taking an example of Indian Currency In present

  • Step 1: Then First we divide 16108 by 2000 then we get 8, 2000 rs notes then go to step 2
  • Step 2: After dividing 2000 we get a remainder of 108 we know that 108 is not divisible by 500 to go to the next step
  • Step 3: Now divide 108 by 100 then we get 1, 100 rs note now the remainder is 8 go to the next step
  • Step 4: 8 is divisible by 50 and 20 nor 10 so we escape now go to the next step
  • Step 5: Now divide 8 by 5 we get 1, 5 rs notes and the remainder is 3 to go to the next step
  • Step 6: Now divide 3 by 2 we get 1, 2 rs notes and the remainder is 1
  • so follow the next step
  • Step 7: This is the Last step divide 1 by 1 we get zero remainder now print the total no of denominations needed along with the total no of counts require to fulfil a requirement

So for 16108, You Need to

8 * 2000 = 16000
1 * 100 = 100
1 * 5 = 5
1 * 2 = 2
1 * 1 = 1

Total =12 Notes For Minimum number of notes program in java


See Also C Program For Denomination of an Amount

Denomination Program in Java for Indian Rupees


import java.util.Scanner;

/* java program to find the number of denominations for a given amount */


public class denomination {

	public static void main(String args[]) {
		int amt, r2000 = 0, r500 = 0, r200 = 0, r100 = 0, r50 = 0, r20 = 0, r10 = 0, r5 = 0, r2 = 0, r1 = 0, count = 0;
		Scanner sc = new Scanner(System.in);

		System.out.print("Enter The Amount in Rupees : \n\n");
		amt = sc.nextInt();

		while (amt >= 2000) {
			r2000 = amt / 2000;
			amt = amt % 2000;
			System.out.print("\nTotal Number Of 2000 Rupees Notes :" + r2000);
			break;
		}

		while (amt >= 500) {
			r500 = amt / 500;
			amt = amt % 500;
			System.out.print("\nTotal Number Of 500 Rupees Notes : " + r500);
			break;
		}
		while (amt >= 200) {
			r200 = amt / 200;
			amt = amt % 200;
			System.out.print("\nTotal Number Of 200 Rupees Notes : " + r200);
			break;
		}
		while (amt >= 100) {
			r100 = amt / 100;
			amt = amt % 100;
			System.out.print("\nTotal Number Of 100 Rupees Notes : " + r100);
			break;
		}

		while (amt >= 50) {
			r50 = amt / 50;
			amt = amt % 50;
			System.out.print("\nTotal Number Of 50 Rupees Notes : " + r50);
			break;
		}

		while (amt >= 20) {
			r20 = amt / 20;
			amt = amt % 20;
			System.out.print("\nTotal Number Of 20 Rupees Notes : " + r20);
			break;
		}

		while (amt >= 10) {
			r10 = amt / 10;
			amt = amt % 10;
			System.out.print("\nTotal Number Of 10 Rupees Notes Or Coin : " + r10);
			break;
		}

		while (amt >= 5) {
			r5 = amt / 5;
			amt = amt % 5;
			System.out.print("\nTotal Number Of 5 Rupees Notes Or Coin : " + r5);
			break;
		}

		while (amt >= 2) {
			r2 = amt / 2;
			amt = amt % 2;
			System.out.print("\nTotal Number Of 2 Rupees Notes Or Coin : " + r2);
			break;
		}

		while (amt >= 1) {
			r1 = amt / 1;
			amt = amt % 1;
			System.out.print("\nTotal Number Of 1 Rupees Note Or Coin : " + r1);
			break;
		}

		count = r2000 + r500 + r100 + r50 + r20 + r10 + r5 + r2 + r1;
		System.out.print("\n\nTotal Number Of Notes Require : \n\n" + count);
	}
}

Denomination Program in Java for Dollar



import
java.util.Scanner; import java.lang.*; /* write a program that displays an amount in rupees in terms of notes of different denominations */ public class denominationusa { public static void main(String args[]) { int amt, r100 = 0, r50 = 0, r20 = 0, r10 = 0, r5 = 0, r2 = 0, r1 = 0, count = 0; Scanner sc = new Scanner(System.in); System.out.print("Enter The Amount in Dollar : \n\n"); amt = sc.nextInt(); while (amt >= 100) { r100 = amt / 100; amt = amt % 100; System.out.print("\nTotal Number Of 100 Dollar : " + r100); break; } while (amt >= 50) { r50 = amt / 50; amt = amt % 50; System.out.print("\nTotal Number Of 50 Dollar : " + r50); break; } while (amt >= 20) { r20 = amt / 20; amt = amt % 20; System.out.print("\nTotal Number Of 20 Dollar : " + r20); break; } while (amt >= 10) { r10 = amt / 10; amt = amt % 10; System.out.print("\nTotal Number Of 10 Dollar Or Coin : " + r10); break; } while (amt >= 5) { r5 = amt / 5; amt = amt % 5; System.out.print("\nTotal Number Of 5 Dollar Or Coin : " + r5); break; } while (amt >= 2) { r2 = amt / 2; amt = amt % 2; System.out.print("\nTotal Number Of 2 Dollar Or Coin : " + r2); break; } while (amt >= 1) { r1 = amt / 1; amt = amt % 1; System.out.print("\nTotal Number Of 1 Dollar Or Coin : " + r1); break; } count = r100 + r50 + r20 + r10 + r5 + r2 + r1; System.out.print("\n\nTotal Number Of Dollar Require : \n\n" + count); } }

See Also C++ Program For Denomination of an Amount

The output of the Denomination Program in Java


The output of Denomination Program in Java

Java program to find the number of denominations for a given amount of Output


Java program to find the number of denominations for a given amount Output

Similar

Previous Post
Next Post

post written by:

Hi, I’m Ghanendra Yadav, SEO Expert, Professional Blogger, Programmer, and UI Developer. Get a Solution of More Than 500+ Programming Problems, and Practice All Programs in C, C++, and Java Languages. Get a Competitive Website Solution also Ie. Hackerrank Solutions and Geeksforgeeks Solutions. If You Are Interested to Learn a C Programming Language and You Don't Have Experience in Any Programming, You Should Start with a C Programming Language, Read: List of Format Specifiers in C.
Follow Me

0 Comments: