Denomination Program In C – Finding The 500, 100, 50, 20, 10, 5, 2, 1

Currency Denomination Program In C. Finding the number of 500, 100, 50, 20, 10, 5, 2, 1 rupees in entered amount. If you are looking for a C program to find denomination example, this C programming example will help you to learn how to write a program for currency denomination in C. Just go through this C programming tutorial to learn about finding the number of 500, 100, 50, 20, 10, 5, 2, 1 rupees.

Denomination Program in C

C Currency Denomination Program – Table of Contents

  • C Program to Display The Denominations of an Amount
  • C Program For Denomination of an Amount Using While Loop – Source Code
  • C Program to Read an Amount and Find Number of Notes – Output
  • C Programming Tutorials

C Program to Display The Denominations of an Amount

Learn how to write a  c Program to Display The Denominations of an Amount. Writing a currency denomination program in C can be done using various techniques but here in this program, we show how to write a c multiplication table program using while loop in a proper way. Happy coding.

C Program For Denomination of an Amount Using While Loop – Source Code

You can copy paste the below C Program For Denomination of an Amount Using While Loop, in c compiler to check how the source code work. Or write your own currency denomination C Program with the help of this below c programming tutorial.

Source Code:

/* C PROGRAM TO DISPLAY DENOMINATIONS OF AN AMOUNT - DENOMINATION.C */

#include<stdio.h>
#include<conio.h>
void main()
{
    int rs, a, b, c, d, e, f, g, h ; //variable declaration
    clrscr() ;
    printf("Enter the amount in Rupees : ") ;
    scanf("%d", &rs) ; //reding input from uer

//C Program Logic For Denomination of an Amount Using While Loop
    while(rs >= 500)
    {
        a = rs / 500 ;
        printf("\nThe no. of five hundreds are : %d", a) ;
        break ;
    }
    while(rs >= 100)
    {
        b = rs / 100 ;
        printf("\n\nThe no. of hundreds are : %d", b) ;
        break ;
    }
    while(rs >= 50)
    {
        c = rs / 50 ;
        printf("\n\nThe no. of fifties are : %d", c) ;
        break ;
    }
    while(rs >= 20)
    {
        d = rs / 20 ;
        printf("\n\nThe no. of twenties are : %d", d) ;
        break ;
    }
    while(rs >= 10)
    {
        e = rs / 10 ;
        printf("\n\nThe no. of tens are : %d", e) ;
        break ;
    }
    while(rs >= 5)
    {
        f = rs / 5 ;
        printf("\n\nThe no. of fives are : %d", f) ;
        break ;
    }
    while(rs >= 2)
    {
        g = rs / 2 ;
        printf("\n\nThe no. of Twos are : %d", g) ;
        break ;
    }
    while(rs >= 1)
    {
        h = rs / 1 ;
        printf("\n\nThe no. of ones are : %d", h) ;
        break ;
    }
    getch() ;
}

C Program to Read an Amount and Find Number of Notes – OUTPUT

After you compile and run the above c program for currency denomination, your C compiler asks you to enter the amount to find the number of 500, 100, 50, 20, 10, 5, 2, 1 rupee notes. After you enter elements, the program will be executed and give output.

Output:

Enter the amount in Rupees : 179
The no. of hundreds are : 1
The no. of fifties are : 3
The no. of twenties are : 8
The no. of tens are : 17
The no. of fives are : 35
The no. of Twos are : 89
The no. of ones are : 179

C PROGRAMMING TUTORIALS

  1. C Program to Print Multiplication Table 
  2. C Program Array with Example
  3. Binary Search in C Program Using Recursion
  4. Bubble Sort in C Using Pointers
  5. Bubble Sort Program in C Using Recursion
  6. Bubble Sort Program in C Using Array
  7. Bubble Sort Program in C Using Function
  8. Bubble Sort Program in C Using Linked List
  9. Stack Push Pop Program in C Using Arrays
  10. Factorial Program in C Using Pointers
  11. Factorial Program in C Using While Loop
  12. C Program For Factorial Using For Loop
  13. Factorial Program in C Using Recursion Function
  14. C Program To Reverse a String Using Pointers
  15. C Program To Swap Two Numbers Using Two Variables
  16. C Program To Swap Two Numbers Using Three Variables
  17. C Program For Prime Numbers – Check  a Number is Prime or Not
  18. C Program To Reverse a String with Using Function
  19. C Program to Reverse a String without Using Function
  20. C Program to Reverse a Sting Using Recursion
  21. C Program For Palindrome String
  22. C Program For Palindrome Numbers
  23. C Program To Reverse a String with Using Function
  24. C Program To Reverse a String without Using Function
  25. C Program To Reverse a String Using Recursion

4 thoughts on “Denomination Program In C – Finding The 500, 100, 50, 20, 10, 5, 2, 1”

  1. why are you using while loops (when you immediately break them inside the loop)?
    here’s a better way:

    int i;
    int dNomArr[8] = {500, 100, 50, 20, 10, 5, 2, 1};

    for (i = 0; i = dNomArr[i]) {
    dNomCount = rs / dNomArr[i];
    printf(“\n The number of %ds are: %d”, dNomArr[i], dNomCount);
    }
    }

    Reply
  2. * below the for statement:
    if (rs >= dNomArr[i]) {

    Reply
  3. #include

    int main ()
    {

    int dnum [8]= {500,100,50,20,10,5,2,1};
    int i,amount,dcount;

    printf (“Enter amount: “);
    scanf (“%d”, &amount);

    for (i=0; i= dnum[i]){
    dcount= amount / dnum[i];
    printf (“\n The number of %d in the amount is: %d”, dnum[i], dcount);
    }
    };
    }

    Reply

Leave a Comment