You are currently viewing WAP to Calculate simple interest

WAP to Calculate simple interest

  • Post category:C Programs
Share this to everyone:
#include <stdio.h>

int main() {
    float principal, rate, time, interest;

    // Prompt the user to enter the principal, rate, and time
    printf("Enter the principal amount: ");
    scanf("%f", &principal);
    printf("Enter the interest rate: ");
    scanf("%f", &rate);
    printf("Enter the time (in years): ");
    scanf("%f", &time);

    // Calculate the simple interest
    interest = (principal * rate * time) / 100;

    // Print the result
    printf("The simple interest is: %.2f\n", interest);

    return 0;
}

Leave a Reply