Answer to Question #16162 in Visual Basic for airi

Question #16162
an old arabic has it that a fabolously wealthy but unthinking king agreed to givea beggarone cent and double the amount for 64 days. using this information,write, run and test a c++ program that display how much the king must pay the beggar on each day. the output of your program should appear as follows
day amount owed
--- -----------
1 0.01
2 0.02
3 0.04
. .
. .
. .
64 .

b. modify the program you wrote for exercise 10a to determine on which day the king will have paid to the beggar a total of one million dollars.
1
Expert's answer
2012-10-09T11:27:05-0400
#include <string>
#include <iostream>
using namespace std;



int main()
{
& double t=0.01,c;

for (int i=1;i<65;i++){
t*=2;
& cout<<i<<" quot;<<t<<"\n";& }


cout<<"\n\n";
system("PAUSE");
}




//b)
#include <string>
#include <iostream>
using namespace std;



int main()
{
& double t=0.01;
int c;
for (int i=1;i<65;i++){
t*=2;
& if (t>1000000){
& c=i;
& i=66;
}
}

cout<<c;
cout<<"\n\n";
system("PAUSE");
}


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

Assignment Expert
10.10.12, 14:25

You're welcome. We are glad to be helpful. If you really liked our service please press like-button beside answer field. Thank you!

airi
10.10.12, 02:12

thank you :)

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS