An old Arabian legend has it that a fabulously wealthy but unthinking king agreed to give a beggar one cent and double the amount for 64 days. Using this information, write, run, and test a C++ program that displays how much the king must pay the beggar on each day. The output of your program should appear as follows:
DayAmount Owed
--- ------------------
1 0.01
2 0.02
3 0.04
..
. .
. .
64 .
#include <stdio.h>
using namespace std;
int main() {
float amount = 0.005;
printf("Day Amount Owed\n");
printf("--- -----------\n");
for (int i = 1; i <= 64; i++) {
amount *= 2;
printf("= %.2f\n", i, amount);
}
return 0;
}