Search C Program | nimishsoft@gmail.com

Compound Interest

/*    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;
}

3 comments:

  1. Awesome site for C programs..

    Learnt how to use conditional operator in this site..

    d=(a>=b?a>=c?a:c:b>=c?b:c);

    ReplyDelete
  2. great site for learning pattern problems

    ReplyDelete