Slip 8 - A) A cashier has currency notes of denomination 1, 5 and 10. Write a C program to accept the withdrawal amount from the user and display the total number of currency notes of each denomination the cashier will have to give.

Solution:

#include<stdio.h>
int main()
{
 int w,x,y,z;
 printf("enter withdrow amount : ");
 scanf("%d",&w);
 x=w/10;
 w=w%10;
 y=w/5;
 w=w%5;
 z=w;
 printf("note of 10 : %d\n",x);
 printf("note of  5 : %d\n",y);
 printf("note of  1 : %d\n",z);
}

Post a Comment

0 Comments