Write a program to simple interest, compound interest and amount.

#include<stdio.h>
#include<math.h>
main()
{
    float p,r,n,si,ci,cia,temp;
   
    printf("\nEnter Principal, rate of interest and number of years=");
    scanf("%f%f%d",&p,&r,&n);

    si=p*n*r/100;
    cia=p*pow((1+(r/100)),n);
    ci=cia-p;

    printf("\nSimple Interest=%f, Amount=%f",si,si+p);
    printf("\nCompound Interest=%f, Amount=%f",ci,cia);
}

No comments:

Post a Comment