C program to calculate simple interest using function
C program to calculate simple interest using function
Let’s understand the steps:
Formula To find simple interest
Simple Interest = (p * n * r) / 100
where,
p = Principal Amount,
n = Number of Years / Period
r = Rate of Interest
example:-
Principal Amount = ₹ 5000
Period = 2 years
Rate of Interest = 10%
Simple Interest = ₹ 1000
Logic to calculate simple interest
Step
Input
- principle amount in variable P.
- time in variable t.
- rate in variable r.
- Find simple interest using formula.
- SI = (p*t*r) / 100
- print output.
C program to calculate simple interest
#include <stdio.h>
int main()
{
    float p, t, r, SI;
     //Input principle, rate and time 
    printf("Enter principle:- ");
    scanf("%f", &p);
    
    printf("Enter time: ");
    scanf("%f", &t);
    printf("Enter rate: ");
    scanf("%f", &r);
    // Calculate simple interest
    SI = (p * t * r) / 100;
    // Print the resultant value of SI
    printf("Simple Interest = %f", SI);
}
Output:



