Sunday, April 12, 2009

Find total number of currency notes of each 10,50,100 denominations

/*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.*/

Solution Code:-
=========

#include <stdio.h>
int main(void)
{
int amt;
printf("Enter the amount to withdraw : ");
scanf("%d",&amt);
printf("\nNotes of 100 required are %d", amt/100);
printf("\nWhile Notes of 50 required are %d", ((amt % 100)/50));
printf("\nAnd notes of 10 required are %d",((amt % 100)% 50)/10);
return 0;
}

No comments: