A cashier has currency notes of denominations 10, 50 and 100. If the amount to be withdrawn is input through the keyboard in hundreds, find the total number of currency notes of each denomination the cashier will have to give to the withdrawer.
This Java program takes an integer amount as input, representing the amount of money to be withdrawn, and computes the minimum number of currency notes of 100, 50, and 10 denominations required to withdraw that amount.
The program prompts the user to enter the amount to be withdrawn using the System.out.println statement and then reads the input using the Scanner class.
The program then computes the minimum number of 100, 50, and 10 denomination notes required to withdraw the given amount of money. This is done by first computing the number of 100 denomination notes that can be withdrawn, which is simply the integer division of the amount by 100. The remainder of this division operation is then used to compute the number of 50 denomination notes and the number of 10 denomination notes using the same method.
Finally, the program outputs the number of 100, 50, and 10 denomination notes required to withdraw the given amount using the System.out.println statement.
import java.util.Scanner; class Currency_Notes { public static void main(String args[]) { Scanner input = new Scanner(System.in); System.out.println("Enter the Amount to be Withdrawn : "); int amt = input.nextInt(); int hundred = amt/100; amt = amt%100; int fifty = amt/50; amt = amt%50; int ten = amt/10; System.out.println("No of Hundred Notes :"+hundred); System.out.println("No of Fifty Notes :"+fifty); System.out.println("No of Ten Notes :"+ten); } }
Enter the Amount to be Withdrawn : 85275 No of Hundred Notes :852 No of Fifty Notes :1 No of Ten Notes :2
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions