Print out the integers between 2 and 256 that are integer powers of 2.
Using a do-while loop, for loop, or while loop.
This is what I have so far but i don't know what to do after that.
1 2 3 4 5 6 7 8 9 10
|
#include <iostream>
using namespace std;
int main()
{
int num;
int min = 2;
int max = 256;
}
|
Also the results should be printed out with 10 integers per line, right justified in a 5 byte field.
Last edited on
1 2 3 4 5
|
num = 0;
while(pow(num, min) <= max){
cout << pow(num, min);
num++;
}
|
Last edited on
Topic archived. No new replies allowed.