Program to calculate simple and compound interest

#include
main()
{
float p,r,si,ci;
int n;
printf("Enter the principle amount : ");
scanf("%f",&p);
printf("Enter the number of years : ");
scanf("%d",&n);
printf("Enter the rate of interest per year : ");
scanf("%f",&r);
si=(p*n*r)/100.0;
ci=p*(pow(1.0+(r/100),n))-p;
printf("\nSimple Interest = %.2f\n",si);
printf("\nCompound Interest = %.2f\n",ci);
}

No comments: