Here's a simple C program to calculate simple interest:
#include <stdio.h>
int main() {
// Declare variables
float principal, rate, time, simpleInterest;
// Input principal amount, rate of interest, and time period
printf("Enter principal amount: ");
scanf("%f", &principal);
printf("Enter rate of interest: ");
scanf("%f", &rate);
printf("Enter time period (in years): ");
scanf("%f", &time);
// Calculate simple interest
simpleInterest = (principal * rate * time) / 100;
// Display the result
printf("Simple Interest = %.2f\n", simpleInterest);
return 0;
}
This program takes user input for the principal amount, rate of interest, and time period. It then calculates the simple interest using the formula: Simple Interest = (principal * rate * time) / 100
. Finally, it displays the calculated simple interest.
Here's an example of what the output might look like when you run the program and input values:
Enter principal amount: 1000 Enter rate of interest: 5.5 Enter time period (in years): 2 Simple Interest = 110.00
In this example, the user entered a principal amount of 1000, a rate of interest of 5.5%, and a time period of 2 years. The program then calculated the simple interest using the formula and displayed the result, which is 110.00.