C program to calculate the Simple interest and Compound interest when Principal, Rate & Time are given.
Program :
#include<stdio.h> // here p=pricipal value,r=rate,t=time
#include<conio.h> // si=simple interest, ci=compound interest
#include<math.h>
void main()
{ float p,r,t,si,ci;
clrscr();
printf("Enter the values of Principal :\n");
scanf("%f",&p);
printf("Enter the value of Rate :\n");
scanf("%f",&r);
printf("Enter the value of Time :\n");
scanf("%f",&t);
si=(p*r*t)/100;
ci=p*(pow((1+r/100),t));
printf("S.I is :%f\n",si);
printf("C.I is :%f",ci);
getch();
}
Comments
Post a Comment