How to write a C Program to Calculate Simple Interest with an example. Before we get into the example, let me show you the formula behind the calculation:
SI = (Principal Amount*Rate of Interest*Number of years) / 100
C Program to Calculate Simple Interest
This program allows the user to enter the Principal Amount, Rate of Interest, and the number of years. By using those above-specified formulas, we will calculate these values within this Program.
#include<stdio.h> int main() { float PAmount, ROI, Time_Period, si; printf("\nPlease enter the Principal Amount : \n"); scanf("%f", &PAmount); printf("Please Enter Rate Of Interest : \n"); scanf("%f", &ROI); printf("Please Enter the Time Period in Years : \n"); scanf("%f", &Time_Period); si = (PAmount * ROI * Time_Period) / 100; printf("\nSimple Interest for Principal Amount %.2f is = %.2f", PAmount, si); return 0; }
