60 403
Assignments Done
98,2%
Successfully Done
In April 2018

Answer to Question #8450 in C++ for selvin gounder

Question #8450
can someone help me with this...the program should exit it shounld go back to the start...help .it is forloop...help me fast...email me the ans..plzzzz.. :)
#include <iostream.h>
#include <stdlib.h>
int main()
{
double princple_amount,rate;
int years,x;
cout<<"Enter initial amount : \t" ;
cin>>princple_amount;
cout <<endl;
cout<< "number of years: \t";
cin>>years;
cout <<endl;
cout<<"Enter interest rate (percent per year):\t" ;
cin>>rate;
cout <<endl;
for ( x=1;x<=years; x=x+1)
{
princple_amount= princple_amount+(princple_amount*rate/100);

}
cout<< " At the end of "<<years<< " years, you will have \t$";
cout<<princple_amount<<endl;
system("PAUSE");
return 0;
}
Expert's answer
#include <iostream.h>

#include <stdlib.h>

int
main()

{
for (int i=0;i<10000;i++){

double
princple_amount,rate;

int years,x;
int
value;

cout<<"Enter initial amount : \t"
;

cin>>princple_amount;

cout
<<endl; cout<<="" "number="" of="" years:="" \t";=""
cin="">>years;

cout <<endl;
cout<<"enter="" interest="" rate="" (percent="" per="" year):\t"="" ;=""
cin="">>rate;

cout <<endl; for="" (=""
x="1;x<=years;" {=""
princple_amount="princple_amount+(princple_amount*rate/100);" }=""
cout<<="" "="" at="" the="" end="" of ="" "<<years<<=""
years,="" you="" will="" have="" \t$";=""
cout<<princple_amount<<endl;
cout<<"If you want
exit, enter 1"<<endl;
cin>>value;
if
(value==1) break;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions