Write a c program to calculate simple interest.

Logics for calculation of simple interest

  1. Input principle amount in some variable say principle.
  2. Input time in some variable say time.
  3. Input rate in some variable say rate.
  4. Find simple interest using formula SI = (principle * time * rate) / 100.
  5. Finally, print the resultant value of SI.
#include <stdio.h>
int main()
{
    float principle, time, rate, SI;
    /* Input principle, rate and time */
    printf("Enter principle (amount): ");
    scanf("%f", &principle);
    printf("Enter time: ");
    scanf("%f", &time);
    printf("Enter rate: ");
    scanf("%f", &rate);
    /* Calculate simple interest */
    SI = (principle * time * rate) / 100;
    /* Print the resultant value of SI */
    printf("Simple Interest = %f", SI);
    return 0;
}

Output

Enter principle (amount): 1200
Enter time: 2
Enter rate: 5.4
Simple Interest = 129.600006

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *