Thursday, December 18, 2014

Program to find simple interest and compound interest

The C program given below is written to find out the simple interest and compound interest of a principle depending on time and rate. This program is tested and 100% accurate. When you will run this program, you will get a message like Enter principle, rate and time: . Then you have to enter the principle first, then rate and finally time. Soon you will get your expected result.
simple interest, compound interest, c program, life of a programmer, c programmer
#include<stdio.h>
#include<math.h>

main()
{
float p, r, t, si, ci;

printf("Enter principle, rate and time: ");
scanf("%f %f %f", &p, &r, &t);

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

printf("\nSimple interest: %.2f", si);
printf("\nCompound interest: %.2f", ci);
}

No comments:

Post a Comment