A PHP Error was encountered

Severity: Warning

Message: fopen(/var/cpanel/php/sessions/ea-php56/PHPSESSID1u172f9amrmvri9dq84gutubhhfao12p): failed to open stream: No space left on device

Filename: drivers/Session_files_driver.php

Line Number: 174

Write a C program to calculate Simple Interest
Q:

Write a C program to calculate Simple Interest

0

C program to calculate Simple Interest

Given principal (amount), time and interest rate and we have to calculate simple interest based on given rate of given time period.

In this program, variable amount is going to be used to store principal amountrate is going to used to store interest rate and time is going to be used to store time and si is going to be used to store simple interest.

Formula to calculate simple interest(principal x rate x time )/100

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

C program for Simple Interest

/* c program to calculate simple interest*/
#include <stdio.h>
 
int main()
{
    float amount,rate,time,si;
 
    printf("Enter principal (Amount) :");
    scanf("%f",&amount);
 
    printf("Enter rate :");
    scanf("%f",&rate);
 
    printf("Enter time (in years) :");
    scanf("%f",&time);
 
    si=(amount*rate*time)/100;
 
    printf("\nSimple Interest is = %f",si);
 
    return 0;
}

Output

Enter principal (Amount) :15000
Enter rate :2.8
Enter time (in years) :2

Simple Interest is = 840.000000

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now

A PHP Error was encountered

Severity: Warning

Message: Unknown: Failed to write session data (user). Please verify that the current setting of session.save_path is correct (/var/cpanel/php/sessions/ea-php56)

Filename: Unknown

Line Number: 0