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
- C Program to Print Multiplication Table
- C Program Array with Example
- Binary Search in C Program Using Recursion
- Bubble Sort in C Using Pointers
- Bubble Sort Program in C Using Recursion
- Bubble Sort Program in C Using Array
- Bubble Sort Program in C Using Function
- Bubble Sort Program in C Using Linked List
- Stack Push Pop Program in C Using Arrays
- Factorial Program in C Using Pointers
- Factorial Program in C Using While Loop
- C Program For Factorial Using For Loop
- Factorial Program in C Using Recursion Function
- C Program To Reverse a String Using Pointers
- C Program To Swap Two Numbers Using Two Variables
- C Program To Swap Two Numbers Using Three Variables
- C Program For Prime Numbers – Check a Number is Prime or Not
- C Program To Reverse a String with Using Function
- C Program to Reverse a String without Using Function
- C Program to Reverse a Sting Using Recursion
- C Program For Palindrome String
- C Program For Palindrome Numbers
- C Program To Reverse a String with Using Function
- C Program To Reverse a String without Using Function
- C Program To Reverse a String Using Recursion
better go in a simply way
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);
}
}
* below the for statement:
if (rs >= dNomArr[i]) {
#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);
}
};
}