How to Calculate Minimum Number of Indian Note in C Language

Calculate Minimum Number of Indian Note in C Language

Introduction :

There are different types of currency notes in India such as 2000, 500, 200, 100, 50, 20, 10, 5, 2, and 1 rupee notes. During cash transactions or money management, you have to break down a given amount into the smallest possible number of notes. Using the C programming language, you can calculate the minimum number of notes required for a given amount.

In this article, I shall show you how to calculate the minimum numbers of Indian currency notes required for a given amount in C programming language.

About the program :

This is a C program which calculates a given amount of money into the smallest possible numbers of Indian currency notes. After you run the program, it asks you to enter a total amount of money. Then, it calculates the minimum number of currency notes needed for a given amount of money in Indian rupees. After that, you can see the output on the console screen. If you enter the amount less than or equal to zero, you can see an error message.

Explanation of the program :

At first, include the standard input output library (stdio.h) in the program. In the main() function, declare integer variables such as “r2000”, “r500”, “r200”, “r100”, “r50”, “r20”, “r10”, “r5”, “r2”, “r1”, “x” and “total”. Using printf() function, ask the user to enter he total amount number. Then, store the input number in “x” variable using scanf() function.

You have to check if the entered amount is greater than 0 or not, using if else statement. Now, calculate the minimum number of notes using division (/) and modulus (%) operator. Finally, display the result on the console screen using printf() function.

How run the program :

To run the program, you can install VS Code on your PC. Then, create a new file with .c extension in VS Code like “currency_system.c”. Now, copy the below code and paste in the “currency_system.c” file. After that, save the file and run the program on your PC.

Source code of the program :

The below code is the source code of calculating Indian currency notes in C programming language.

Output of the program :

When you run the program, You can see the output of the program on your PC.

Output of Calculate Minimum Number of Indian Note in C Language

Conclusion :

After completing the above article, you have learned how to calculate minimum numbers of Indian rupee notes in C programming language. Thank you for visiting my site.

Scroll to Top