C C++ Java Data Structure Python JavaScript CSS Ajax PL/SQL PHP Puzzles C programs C++ programs Java programs

Home » Java programs » Java basic programs

Java program to count number of notes (rupees) in given amount

Here, we are implementing a java program that will read an amount and then convert, count total number of different notes (rupees).
Submitted by Chandra Shekhar, on January 08, 2018

Given an amount and we have to count total number of different notes (rupees) using java program.


    Amount is: 54206

    Notes of:
    1000 - 54
    100 – 2
    5 -1
    1 -1
    Total number of notes is: 58

Program to count number of different notes in java

import java.io.*;

class CountNotes
	public static void main(String args[])throws IOException
		// create object of buffer class.
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		// The Rsominations in an array
		int Rs[]={1000,500,100,50,20,10,5,2,1}; 
		// enter the amount you want.
		System.out.print("Enter any Amount : "); 
		// to store amount.
		int amount=Integer.parseInt(br.readLine());
		// create copy of the amount
		int copy=amount; 
		int totalNotes=0,count=0;
		System.out.println("\nRs OMINATIONS : \n");
		// check for notes.
		for(int i=0;i<9;i++) 
			// count number of notes.
				System.out.println(Rs[i]+"\tx\t"+count+"\t= "+Rs[i]*count);
			totalNotes=totalNotes+count; //finding the total number of notes
			amount=amount%Rs[i]; //finding the remaining amount whose Rsomination is to be found
		// printing the total amount
		System.out.println("TOTAL\t\t\t= "+copy); 
		// printing the total number of notes
		System.out.println("Total Number of Notes\t= "+totalNotes); 


Enter any Amount : 54206


1000	x	54	= 54000
100	x	2	= 200
5	x	1	= 5
1	x	1	= 1
TOTAL			= 54206
Total Number of Notes	= 58

You may also be interested in...

C/C++ Tips and Tricks...

Was this page helpful? YES NO

Are you a blogger? Join our Blogging forum.

Comments and Discussions