A bank ATM stores the money in the following denominations h
A bank ATM stores the money in the following denominations- hundreds, twenties, tens, fives, and ones. The bank has the following policy. When a customer withdraws money, the ATM dispenses the amount using the maximum bills from the heights to the lowest denominations. For example, if the customer request an amount of 293, the ATM dispenses 2 hundreds, 4 twenties, 1 tens, and 3 ones. This is a Java program
Solution
package org.students;
import java.util.Scanner;
public class ATMMachine {
   public static void main(String[] args) {
        //Declaring variables
        int req_amount;
    int hundreds,twenties,tens,fives,ones,rem_amt;
      
    //Scanner class object is used to read the inputs entered by the user
    Scanner sc=new Scanner(System.in);
      
    //Getting the request amount entered by the user
    System.out.print(\"Enter Request Amount :\");
    req_amount=sc.nextInt();
      
    //Calculating the number of hundreds
 hundreds=req_amount/100;
 rem_amt=req_amount-(hundreds*100);
 
 //Calculating the number of twenties
 twenties=rem_amt/20;
 rem_amt=rem_amt-twenties*20;
 
 //Calculating the number of tens
 tens=rem_amt/10;
 rem_amt=rem_amt-tens*10;
 
 //Calculating the number of fives
 fives=rem_amt/5;
 rem_amt=rem_amt-fives*5;
 
 //Calculating the number of ones
 ones=rem_amt;
 
 //Displaying the denominations
    System.out.println(\"The ATM dispenses \ \"
 +hundreds +\" hundreds, \ \"
    +twenties+\" twenties, \ \"
 +tens+\" tens,\ \"
    +fives+\" fives, and \ \"
 +ones+\" ones\");
    }
}
____________________________
Output:
Enter Request Amount :293
 The ATM dispenses
 2 hundreds,
 4 twenties,
 1 tens,
 0 fives, and
 3 ones
_____________Thank You


