Program to calculate Compound Interest :-
#include<iostream.h>
#include<conio.h>
#include<math.h>
#include<conio.h>
void main()
{
double p,R,y,t,n,r,a,z1,z2,z3;
cout<<"\t\tWELCOME TO CI CALC";
getch();
cout<<"Enter Principal Amount:";
cin>>p;
cout<<"Enter rate P.A.:";
cin>>R;
cout<<"Enter no. of years";
cin>>y;
cout<<"Enter no. of times compounded per year :";
cin>>t;
n=t*y;
r=R/t;
z1=100+r;
z2=z1/100;
z3=pow(z2,n);
a=p*z3;
cout<<"\nThe total amount is :"<<a;
cout<<"\nThe Interest is :"<<(a-p);
cout<<"\nThe new principal is :"<<a;
getch();
}
#include<iostream.h>
#include<conio.h>
#include<math.h>
#include<conio.h>
void main()
{
double p,R,y,t,n,r,a,z1,z2,z3;
cout<<"\t\tWELCOME TO CI CALC";
getch();
cout<<"Enter Principal Amount:";
cin>>p;
cout<<"Enter rate P.A.:";
cin>>R;
cout<<"Enter no. of years";
cin>>y;
cout<<"Enter no. of times compounded per year :";
cin>>t;
n=t*y;
r=R/t;
z1=100+r;
z2=z1/100;
z3=pow(z2,n);
a=p*z3;
cout<<"\nThe total amount is :"<<a;
cout<<"\nThe Interest is :"<<(a-p);
cout<<"\nThe new principal is :"<<a;
getch();
}
No comments:
Post a Comment