#include
#include
int main()
{
clrscr();
float amount;
float value(float p,int n,float r=0.15);
void printline(char ch='*', int len=40);
printline();
amount=value(5000.00,5);
cout<<"\n\n Final value= "<
getch();
return 0;
}
float value(float p,int n,float r)
{
int year=1;
float sum=p;
while(year<=n)
{
sum=sum*(1+r);
year=year+1;
}
return(sum);
}
void printline(char ch,int len)
{
for(int i=1;i<=len;i++)
cout<
}
Output:
****************************************
Final value= 10056.786133
****************************************
No comments:
Post a Comment