Finding Compound Interest In C Programming



#include <stdio.h>
#include <conio.h>
#include <math.h>
int main()
{
   
    //a = p(1+r/q)power(nq)
    float a,p,q,n,r;
    int i; 
    for(i=0; i<1; i++) (to use power function we need looping)
initialization, condition, increment
    {
        printf("\n Enter the Principle Amount :");
        scanf("%f", &p);
        printf("\n Enter the Rate Of Interest :");
        scanf("%f", &r);
        printf("\n Enter the Number of Years :");
        scanf("%f", &n);
        printf("\n Enter the Compounding Period :");
        scanf("%f", &q);
        a=p*pow((1+(r/q)), (n/q));
        printf("\n Total Amount :%f",a);
    }
   

    return 0;
}

Comments