C Program for FUNCTION OF COMPOUND INTEREST
float ci(float,float,float);
void main()
{
float p=0,r=0,n=0,k=0;
clrscr();
printf("ENTER THE PRINCIPAL: ");
scanf("%f",&p);
printf("ENTER THE RATE OF INTEREST= ");
scanf("%f",&r);
printf("ENTER THE PERIOD= ");
scanf("%f",&n);
k=ci(p,r,n);
printf("THE COMPUND INTEREST IS %f",k);
getch();
}
float ci(float p,float r,float n)
{
float k=0,t=0;
for(t=1;t<=n;t++)
{
k=(p*r)/100;
p=p+k;
}
return(k);
}
OUTPUT :
ENTER THE PRINCIPAL : 10000
ENTER THE RATE OF INT : 5
ENTER THE PERIOD : 10
THE COMPOUND INTEREST IS 775.664062