Find Compound Interest Program in C

Advertisements

Prev Tutorial Next Tutorial

C Program to Find Compound Interest

Compound Interest is the addition of interest to the principal sum of a loan or deposit. in other word The concept of compound interest is that interest is added back to the principal sum so that interest is earned on that added interest during the next compounding period.

Compound Interest Example in C

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

void main()
{
   float p,r,i,t,ci,a;
   clrscr();

   printf("Enter Principal amount : ");
   scanf("%f",&p);
   printf("Enter interest rate : ");
   scanf("%f",&r);
   printf("Enter time period in years: ");
   scanf("%f",&t);

   i=1+(r/100);

   // ci=pow(i,t);
   ci=1;
   for(a=1;a<=t;a++)
   ci=ci*i;

   ci=p*ci-p;

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

   getch();
}

Output 1

Enter Principal amount: 1000
Enter interest rate: 2
Enter time period in years: 1
Compound interest is : 20.00

Output 2

Enter Principal amount: 1000
Enter interest rate: 2
Enter time period in years: 2
Compound interest is : 40.40

Output 3

Enter Principal amount: 1000
Enter interest rate: 3
Enter time period in years: 4
Compound interest is : 125.51

Prev Tutorial Next Tutorial

Google Advertisment

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

For Projects 9999595223

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements