Write a C program to calculate compound Interest


Introduction

Write a C program to calculate compound Interest


techstudy.org

Kindle Paperwhite High Resolution Display Tablet | Rs. 9999

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#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

C language
     






Related Topics


Responses




Popular Posts

Facebook

Founded in 2016, Tech Study passionately delivers stylish and dynamic innovative information to programmer and technology lovers. http://www.techstudy.org/.