C++ Chapters

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.

Structure of C++ Programs - Overview
#include <iostream>
using namespace std;

int main()
{
    int Amount;
    
    cout << "Please Enter Amount for Withdraw : ";
    cin >> Amount;
    
    cout << "\n\nRequired notes of 100 is : " << Amount / 100;
    cout << "\nRequired notes of 50 is : " << (Amount % 100) / 50;
    cout << "\nRequired notes of 10 is : " << (((Amount % 100) % 50) / 10);
    cout << "\nAmount still remaining is : " << (((Amount % 100) % 50) % 10);
    
    return 0;
}

Output :
Please Enter Amount for Withdraw : 1275

Required notes of 100 is : 12
Required notes of 50 is : 1
Required notes of 10 is : 2
Amount still remaining is : 5

Leave a comment
Recent Comments
No Comments