(k) 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.

Let Us C by Yashwant Kanetkar

 

Solution By Muhammad Kaleem UIlah



                                                                  Exercise Questions 
[H] Write C programs for the following:

(k) 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.

int main()

{

    int withdraw,h,f,t,remember,remember1;

    printf("\n\t\t Enter Your Withdraw Amount = ");

    scanf("%d",&withdraw);

    h=withdraw/100;

    remember=withdraw%100;

    printf("\n\t\t Number Of Hundreds Notes = %d",h);

   if (remember>50)

   {

       f=remember/50;

       remember1=remember%50;

       remember1=remember1/10;

       printf("\n\t\t Number of Fifty Notes = %d",f);

       printf("\n\t\t Number of Tens Notes =%d\n",remember1);

   }

   else

   {

    t=remember/10;

    printf("\n\t\t Number of Tens Notes = %d\n",t);

   }

    return 0;

}


Comments

Popular posts from this blog

(e) The length & breadth of a rectangle and radius of a circle are input through the keyboard. Write a program to calculate the area & perimeter of the rectangle, and the area & circumference of the circle.

(b) The distance between two cities (in km.) is input through the keyboard. Write a program to convert and print this distance in meters, feet, inches and centimeters.

(g) If a five-digit number is input through the keyboard, write a program to calculate the sum of its digits. (Hint: Use the modulus operator ‘%’)