/* Compund Interest */
#include<stdio.h>
#include<math.h>
int main()
{
float p,r,i,t,ci,a;
printf("Type the amount : ");
scanf("%f",&p);
printf("Type the interest rate : ");
scanf("%f",&r);
printf("Type the 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("Your compound interest is : %.2f",ci);
return 0;
}
#include<stdio.h>
#include<math.h>
int main()
{
float p,r,i,t,ci,a;
printf("Type the amount : ");
scanf("%f",&p);
printf("Type the interest rate : ");
scanf("%f",&r);
printf("Type the 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("Your compound interest is : %.2f",ci);
return 0;
}
Awesome site for C programs..
ReplyDeleteLearnt how to use conditional operator in this site..
d=(a>=b?a>=c?a:c:b>=c?b:c);
great site for learning pattern problems
ReplyDeletenice article for beginners.thank you.
ReplyDeletewelookups C++
javacodegeeks