The simple interest on a loan is calculated by the formula
interest = principal * rate * days / 365;
The preceding formula assumes that rate is the annual interest rate, and therefore includes thedivision by 365 (days). Develop a program that will input principal, rate and days for several loans, and will calculate and display the simple interest for each loan, using the preceding formula. Here is a sample input/output dialog:
********************************
#include <stdio.h>
#include <stdlib.h>
int main ()
{
float principal;
float rate;
int days;
float interest;
do
{
printf("Enter loan principal (-1 to end): ");
scanf("%f",&principal);
printf("Enter interest rate: ");
scanf("%f",&rate);
printf("Enter term of the loan in days: ");
scanf("%d",&days);
interest = ( principal * rate * days ) / 365;
printf("The interest charge is $%f",interest);
}while( principal == -1 );
system("PAUSE");
return 0;
}