Skip to main content

Program to calculate simple interest in c

C Program to calculate simple interest. Here more solutions.

// Include header file
#include <stdio.h>
//  C program for
//  Calculate simple interest

// Method which is take three parameters
// And calculates that simple interest
// Here time is form in year
// rate is form of annual interest rate
void  simpleInterest (double principle, double time, double rate)
{
    // Display parameters values
    printf("Principle : %lf\n" , principle);
    printf("Time      : %lf\n" , time);
    printf("Rate      : %lf\n" , rate);
    // Calculate interest
    double amount = (principle * time * rate) / 100;
    // Display amount
    printf("Simple Interest : %lf\n\n" , amount);
}

int main()
{
    // Test Cases
    simpleInterest(1500, 3, 7.3);
    simpleInterest(170.4, 7, 3.4);
	return 0; 
}

Output

Principle : 1500.000000
Time      : 3.000000
Rate      : 7.300000
Simple Interest : 328.500000

Principle : 170.400000
Time      : 7.000000
Rate      : 3.400000
Simple Interest : 40.555200




Comment

Please share your knowledge to improve code and content standard. Also submit your doubts, and test case. We improve by your feedback. We will try to resolve your query as soon as possible.

New Comment