### Help with changing a program

Hello, i would like to change this program that someone on this forum helped me make, the program works fine, but i dont know how to make it only show the 4th root of even numbers from 2-20

 ``1234567891011121314151617`` ``````#include #include using namespace std; int main() { int numb; for(numb=0; numb<=30; numb++) { if(numb%2!=0){ cout << setw(4) << numb; int cube = numb*numb*numb; cout << setw(6) << cube << endl; }//end if } system("PAUSE"); return 0; }``````
Hi there,

Some hints:

- "of numbers 2-20" - you will have to change your for-loop on line 7.
- you will need to introduce a way that calculates the fourth power of a number so you can check it against "the even number between 2 and 20".

Please have a go at modifying the code and come back to us with any specific issues you encounter.

All the best,
NwN
 ``12345678910111213141516`` ``````#include #include using namespace std; int main() { int numb; for(numb=0; numb<=30; numb++) { if(numb%2==0) { //here cout << setw(4) << numb; int quad = numb*numb*numb*numb; //and here cout << setw(8) << quad << endl; } } system("PAUSE"); return 0; }``````
Last edited on
i changed it to theis

 ``123456789101112131415161718`` ``````#include #include using namespace std; int main() { int numb; for(numb=2; numb<=20; numb++) { if(numb%2!=0){ cout << setw(4) << numb; int cube = numb*numb*numb*numb; cout << setw(8) << cube << endl; }//end if } system("PAUSE"); return 0; } ``````

And I'm assuming i have to change line 9 somehow, but i'm stuck.
Thanks guys. i got it, thanky ou for the help once again, i love this site!!
Topic archived. No new replies allowed.