Tech Unleashed

Wohoo!! We're on YouTube

Thursday, 20 January 2022

C program for "A cashier has currency notes of dominations 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 domination the cashier will have to give to the withdrawer."

Problem: C program for "A cashier has currency notes of dominations 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 domination the cashier will have to give to the withdrawer."

Formulae used :
tens = amount / 10
fifties = amount / 50
hundreds = amount / 100

C program :

// Program by Shyam Kanth

#include<stdio.h>

int main(){
    int amount,tens,fifties,hundreds;
    printf("Enter the amount is hundreds : ");
    scanf("%d", &amount);
    tens = amount/10;
    fifties = amount/50;
    hundreds = amount/100;
    printf("Total number of notes to give : \n");
    printf("Tens : %d notes.\n",tens);
    printf("Fifties : %d notes.\n",fifties);
    printf("Hundreds : %d notes.\n",hundreds);
    return 0;
}

Codes used : 
  • #include < stdio.h > : Header file for input-output
  • int : Integer data type
  • amount, tens, fifties, hundreds : Variable used
  • printf : Function for displaying message
  • scanf : Function for taking input
  • %d : Format specifier for integer type data
Do comments, If any doubt
Know about me : Shyam Kanth

No comments:

Post a Comment