C program to find Simple and compound interest.
What is Simple interest? Click here to read about it.
What is Compound interest? Click here to read about it.
Simple interest Formula : ( P x N x R )/100
Compound interest Formula : P ( 1 + R / 100)N
Where
P : The principal amount.
N : Number of years.
R : Rate of interest.
Links that you may find important :
http://math.about.com/od/businessmath/ss/Interest.htm
http://math.about.com/od/formulas/a/compound.htm
Code :
What is Simple interest? Click here to read about it.
What is Compound interest? Click here to read about it.
Simple interest Formula : ( P x N x R )/100
Compound interest Formula : P ( 1 + R / 100)N
Where
P : The principal amount.
N : Number of years.
R : Rate of interest.
Links that you may find important :
http://math.about.com/od/businessmath/ss/Interest.htm
http://math.about.com/od/formulas/a/compound.htm
Code :
#include <stdio.h>
#include <conio.h>
#include <math.h>
void main()
{
float p,si,ci,r;
int n;
clrscr();
printf("Program to find Interest");
printf("\n\nPrinciple amount :");
scanf("%f",&p);
printf("\nNumber of years :");
scanf("%d",&n);
printf("\nRate of interest:");
scanf("%f",&r);
si=p*n*r/100; //Simple interest calculation
printf("\nSimple Interest = %1.2f",si);
ci=p*pow(1+r/100,n); //Compound interest calculation
printf("\nCompound Interest = %1.2f",ci);
getch();
}
Output :
Program to find Interest Principle amount :5000 Number of years :10 Rate of interest:7.5 Simple Interest = 3750.00 Compound Interest = 10305.16Note : Leave a comment if you feel the program is incorrect and/or has errors and/or if the program and its output don't match. Please report about broken links.
No comments:
Post a Comment