Write a program in C to calculate simple interest for a set of values representing principal, no of years, and rate of interest.

#include <stdio.h>


int main(){

    float p, r;

    int t;


    printf("Enter the principal value: ");

    scanf("%f", &p);

    printf("\nEnter the rate of interest: ");

    scanf("%f", &r);

    printf("\nEnter the no of years: ");

    scanf("%d", &t);


    float si=(p*r*t)/100;


    printf("\nThe simple interest is: %f", si);

    printf("\nAmount have to be pay after %d years is: %f", t, p+si);


    return 0;

}


Comments