Write a program in C language to calculate the simple interest. In this article, we will write a program in c language to calculate the simple interest.
What is simple interest?
Simple interest is a method to calculate the amount of interest charged on a sum at a given rate and for a given period of time. and Simple interest is a quick and easy method to calculate interest on the money.
Some useful terms in the program
- SI = simple interest
- Formula to calculate SI : (P * R * t)/100
- where,
- P = principle ,
- R = Rate of Interest in % per annum,
- T = the number of years.
Algorithm to calculate the simple interest
- Start
- Declare the variables.
- Initialize the Variables.
- Calculate the Simple Interest using ((P*R*T)/100).
- Print the Simple Interest.
- End.
Program in C to calculate the simple interest
#include<stdio.h> int main(){ float rate=5, principle=100, time=2 float si; si=(rate*principle*time)/100; printf("simple interest is %f",si); return 0; }
Explanation of source code
Step 1: start.
Step 2: Include header files using #include.
Step 3: then create a main function method with the int return type.
Step 4: then declare the variable in float and give the respected value to it.
Step 5: and then create the formula of simple interest ((P*R*T*)/10).
Step 6: After then print with the help of the “printf()” statement.
Step 7: After successful completion return 0.
Step 8: end.
Output
In this way, we create a program in C language to calculate the simple interest.