Index « Previous Next »

Question

Write a program which accept principle, rate and time from user and print the simple interest.
The formula to calculate simple interest is:
simple interest = principle x rate x time / 100

Source Code

#include <stdio.h>

int main()
{
    float principle, rate, time, simple_interest;

    printf("Enter the principle :");
    scanf("%f", &principle);
    printf("Enter the rate :");
    scanf("%f", &rate);
    printf("Enter the time :");
    scanf("%f", &time);

    simple_interest = principle * rate * time / 100;

    printf("Simple interest is %0.2f", simple_interest);

    return 0;
}

Output

Enter the principle :5400
Enter the rate :8
Enter the time :3
Simple interest is 1296.00