I have to make a program that has this 2, 4, 8, 16, 32,..... but i cannot use po
ID: 3623295 • Letter: I
Question
I have to make a program that has this 2, 4, 8, 16, 32,..... but i cannot use pow(x,y) or cin,
i can only use the while loop, or for loop.
I know it is 21, 22, 23, 24,.......
but i cannot figure it out. here is a another one that i have to doand i did it but the top one i cannot get it
1, 8, 27, 64, 125,216,....., which is 13, 23, 33, 43, ........
and the code is:
#include "stdafx.h"
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
int k;
k = 0;
while ( k < 10 )
{
cout << " " << (k+1)*(k+1)*(k+1);
k = k + 1;
}
cout << " ";
return 0;
}