C program to calculate simple interest using function

Rate this post

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

  1. principle amount in variable P.
  2. time in variable t.
  3. rate in variable r.
  4. Find simple interest using formula.
  5. SI = (p*t*r) / 100
  6. 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:

C-program-to-calculate-simple-interest-2
C-program-to-calculate-simple-interest-2

 

For any query or issue, feel free to discuss on http://discuss.eduguru.in

Leave a Reply

%d bloggers like this: