In this C program, we will learn about how to read principal amount, rate of interest and time from user and calculate simple interest. We will first read Principle amount, rate of interest and time using scanf function. We will use below mentioned formulae to calculate Simple Interest (SI).
Required Knowledge
- Simple Interest = (Principle x Rate x Time) / 100
C program to calculate simple interest
#include <stdio.h> int main() { float principle, rate, time, simpleInterest; printf("Enter Principle Amount\n"); scanf("%f", &principle); printf("Enter Rate of Interest\n"); scanf("%f", &rate); printf("Enter Time of Loan\n"); scanf("%f", &time); // Simple Interest = (Principle X Rate X Time)/100; simpleInterest = (principle * rate * time)/100; printf("Simple Interest = %.2f", simpleInterest); return 0; }Output
Enter Principle Amount 10000 Enter Rate of Interest 5 Enter Time of Loan 2 Simple Interest = 1000.00Related Topics