Compound Interest

Compound Interest

Welcome to the World of Online Learning:

Hello Friends “This blog helps you to learn C programming concepts. You can learn C language at your own speed and time. One can learn concepts of C language by practicing various programs given on various pages of this blog. Enjoy the power of Self-learning using the Internet.”

Compound Interest
Compound Interest

Write a C program to Compound Interest

PROGRAM: 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;
}

Leave a Reply

Your email address will not be published. Required fields are marked *