Q:

C program to calculate compound interest

0

C program to calculate compound interest

This program will read principal, rate and time in years and then print compound interest on entered principal for given time period.

Compound interest is the amount in which interest is added into the principle so that interest also can be earned interest with the principle.

The formula to get compound interest is:

compound_interest=principal*((1+rate/100)time-1)

All Answers

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

Calculate Compound Interest using C program

/*C program to calculate compound interest.*/

#include <stdio.h>
#include <math.h>

int main()
{
    float principal, rate, year, ci;

    printf("Enter principal: ");
    scanf("%f", &principal);

    printf("Enter rate: ");
    scanf("%f", &rate);

    printf("Enter time in years: ");
    scanf("%f", &year);

    // calculate compound interest

    ci = principal * ((pow((1 + rate / 100), year) - 1));

    printf("Compound interest is: %f\n", ci);

    return 0;
}

Output:

    Enter principal: 10000
    Enter rate: 10.25 
    Enter time in years: 5
    Compound interest is: 6288.943359 

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

total answers (1)

C language important programs ( Advance Programs )

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Program to print weekday of given date... >>