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.

/* 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. */
#include<stdio.h>
int main()
{
	int amount;
	printf("Please input amount for withdraw : ");
	scanf("%d",&amount);

	//calculations
	printf("\n\nRequired notes of Rs. 100  :  %d", amount / 100);
	printf("\n\nRequired notes of Rs. 50   :  %d", (amount % 100) / 50);
	printf("\n\nRequired notes of Rs. 10   :  %d", (((amount % 100) % 50) / 10));
	printf("\n\nAmount still remaining Rs. :  %d", (((amount % 100) % 50) % 10));
	return 0;
}

Output :
Please input amount for withdraw : 1275

Required notes of Rs. 100 : 12

Required notes of Rs. 50 : 1

Required notes of Rs. 10 : 2

Amount still remaining Rs. : 5



Leave a comment