Write a C Program to calculate Simple and Compound interest
C Program to Calculate Simple and Compound Interest
*****************************************************
www.flintgroups.com
*****************************************************
#include<conio.h>
#include<stdio.h>
#include<math.h>
void main()
{
double p,n,r,simple,compound;
clrscr();
printf("|********************************|");
printf("\nwww.flintgroups.com\n");
printf("|********************************|");
printf("\nEnter principal Amount in Rs:");
scanf("%lf",&p);
printf("Enter rate of interest in percentage :");
scanf("%lf",&r);
printf("Enter number of years:");
scanf("%lf",&n);
simple=p*n*r/100;
compound=pow((1+r/100),n)*p-p;
printf("\nSimple interest =Rs %.2lf",simple);
printf("\nCompound Interest =Rs %.2lf",compound);
getch();
}
Sample output for this program is shown below.
C Program to Calculate Simple and Compound Interest
*****************************************************
www.flintgroups.com
*****************************************************
#include<conio.h>
#include<stdio.h>
#include<math.h>
void main()
{
double p,n,r,simple,compound;
clrscr();
printf("|********************************|");
printf("\nwww.flintgroups.com\n");
printf("|********************************|");
printf("\nEnter principal Amount in Rs:");
scanf("%lf",&p);
printf("Enter rate of interest in percentage :");
scanf("%lf",&r);
printf("Enter number of years:");
scanf("%lf",&n);
simple=p*n*r/100;
compound=pow((1+r/100),n)*p-p;
printf("\nSimple interest =Rs %.2lf",simple);
printf("\nCompound Interest =Rs %.2lf",compound);
getch();
}
Sample output for this program is shown below.

0 comments:
Post a Comment