Starting Vocational Training From 1-May-2024 Get Detail


 Write a C programming that accepts principal amount, rate of interest and days for a loan and calculate the simple interest for the loan, using the following formula.
interest = principal * rate * days / 365.
Sample Input:
10000
.1
365
0
Sample Output:
Input loan amount (0 to quit): Input interest rate: Input term of the loan in days: The interest amount is $1000.00
Input loan principal_amt (0 to quit):


#include<stdio.h>
int main()
{
    float principal_amt, rate_of_interest, days, interest;
    const int yearInDays = 365;
    
    printf( "Input loan amount (0 to quit): " );
    scanf( "%f", &principal_amt );

    while( (int)principal_amt != 0) 
    {
        printf( "Input interest rate: " );
        scanf( "%f", &rate_of_interest );
        printf( "Input term of the loan in days: " );
        scanf( "%f", &days );

        interest = (principal_amt * rate_of_interest * days )/ yearInDays;
        printf( "The interest amount is $%.2f ", interest );

        printf( " Input loan principal_amt (0 to quit): " );
        scanf( "%f", &principal_amt );
    }

    return 0;
}