Monday, 23 December 2013

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. (C++ code)

#include<iostream>
using namespace std;
#include<conio.h>
int main ()
{
    int amount;
 
  
    cout<<"Enter the amount to be withdrawn (in hundreds): ";
    cin>>amount;
  
   
    cout<<"\n\nRequired notes of Rs. 100  :  "<< amount / 100;
  
    cout<<"\n\nRequired notes of Rs. 50   :  "<< (amount % 100) / 50;
 
  
    cout<<"\n\nRequired notes of Rs. 10   :  "<< (((amount % 100) % 50) / 10);
  
    cout<<"\n\nAmount still remaining Rs. :  " <<(((amount % 100) % 50) % 10);
  
    getch();
     return 0;

  /*  Letuswithc:

       this page is designed to help you learn C or C++.
  Understandable C and C++ programming tutorials, compiler reviews, source code, tips and tricks. 
         */
}

No comments:

Post a Comment