C Program to Read an Amount and Find Number of Notes

In this C program, we will split a given amount into currency notes.Starting from the highest denomination note, we will try to accommodate as many notes possible.

Let amount is A and current note is N, then number of notes is A/N and remaining amount is A%N.Let's say A = 450 and N = 100, then number of 100 notes is 450/100 = 4 and remaining amount is 450%100 = 50.
We will repeat this process for all notes in decreasing order.

Required Knowledge

C program to accept an amount and find number of notes

#include <stdio.h>  
int main() {  
    int number, i;
    int notes[7] = {1000, 500, 100, 50, 10, 5, 1};
    int noteCounter[7] = {0};  
    printf("Enter a Number\n");  
    scanf("%d", &number);  
    for(i = 0; i < 7; i++) {
        if(number >= notes[i]){
            noteCounter[i] = number/notes[i];
            number = number - noteCounter[i]*notes[i];
    /* Print notes */
    printf("Currency   Count\n");
    for(i = 0; i < 7; i++){
        if(noteCounter[i] != 0){
            printf("%d  %d\n",notes[i],noteCounter[i]);
    return 0;  
Enter a Number
Currency   Count
500  1
100  3
50  1
10  1
1   3

Related Topics
C program to print natural numbers in reverse order from N to 1
C program to print even numbers between 1 to N using for and while loop
C program to find ones complement of a binary number
C program to find sum of all odd numbers between 1 to N using for loop
C program to check whether a number is magic number
C program to check a number is odd or even using conditional operator
C program to find perfect numbers between 1 to N using for loop
C program to find hcf and lcm of two numbers
C program to check a number is palindrome or not
List of all C programs