Simple interest calculation
Program
#include <stdio.h>
int main() {
float principal, rate, time, simpleInterest;
// Input values
printf("Enter Principal amount: ");
scanf("%f", &principal);
printf("Enter Rate of Interest (in %%): ");
scanf("%f", &rate);
printf("Enter Time (in years): ");
scanf("%f", &time);
// Simple Interest formula
simpleInterest = (principal * rate * time) / 100;
// Output result
printf("Simple Interest = %.2f\n", simpleInterest);
return 0;
}
Output:
Comments
Post a Comment