Simple Interest is a process through which we can find out the interest on a particular principal amount.
You must have seen that people borrow money from banks or other people and, in return, return the money with interest.
Simple interest is a means through which we can easily find out how much money we have lent and how much interest has been earned on it.
In today’s article, I will tell you how to write a C code to calculate simple interest.
The formula for Calculating Simple Interest
(P * n * r): principal amount * Number of Years * Rate of interest
C Program to calculate simple interest.
//C Program of simple interest
#include <stdio.h>
/*pr=principal amount , n = number of years, rate = rate of interest ,si= simple interest*/
int main() {
int pr,n;
float rate,si;
pr=6000;
n =2;
rate=5.5;
//Formula of simple interest ( p*n*r/100)
si = pr*n*rate/100;
printf("Interest in 2 years= %f\n",si);
printf("Your Total amount = %f",pr+si);
return 0;
}
Similar articles: