Q:

Write a C program to calculate compound Interest

0

Write a C program to calculate compound Interest

All Answers

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

#include<stdio.h>
#include<math.h>
int main()
{
     float amount, rate, intrest, time, ci, a;

     /*Reading amount, rate of intrest
       and period in years from user
     */
     printf("Type the amount : ");
     scanf("%f", &amount);
     printf("Type the interest rate : ");
     scanf("%f", &rate);
     printf("Type the period in years: ");
     scanf("%f", &time);

     intrest = 1+(rate/100);

     // ci=pow(intrest,time);
     ci = 1;
     for(a = 1; a <= time; a++)
        ci = ci * intrest;

     ci = amount * ci - amount;

     printf("Your compound interest is : %.2f", ci);

     return 0;
}

Result:

Type the amount : 5000

Type the interest rate : 10

Type the period in years: 1

Your compound interest is : 500.00

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

total answers (1)

Write a C program to check whether a number is Pri... >>
<< Write C program to find Armstrong numbers between ...