#include <stdio.h>
int main() {
float principal, rate, time, interest;
// Input principal amount
printf("Enter principal amount: ");
scanf("%f", &principal);
// Input rate of interest
printf("Enter rate of interest (in percentage): ");
scanf("%f", &rate);
// Input time period in years
printf("Enter time in years: ");
scanf("%f", &time);
// Calculate simple interest
interest = (principal * rate * time) / 100;
// Display the result
printf("Simple Interest = %.2f\n", interest);
return 0;
}
Comments
Post a Comment