Find Compound Interest Program in C


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

Advertisements
z
Download Projects

Advertisements

Download WhatsApp Status Video

Buy This Ad Space Only $50 per Month, Ad Size 300X250 Contact on: [email protected] WhatsApp no. 8882538826

Google Adsense Advertisements