This is the exact question that i need to complete, but i can sem to get all of it.
I have gotten to the part were i can put in a string of numbers until I enter a 0 but as soon as that is done i hae problems. I think i need to do a nested while loop thing but cant figure out how to set the stuff all up.
If anyone can point me in the right direction and help me out it would be greatly appreciated!!
Write a program segment that reads a sequence of integers until a 0 is encountered. For each number read, output the number of times the number can be divided by 2 before you get 0. For example, if the input is:
2
9
-7
4
-3
0
The code will read in all the integers, and produce the following output:
2
4
3
3
2
I have gotten to the part were i can put in a string of numbers until I enter a 0 but as soon as that is done i hae problems. I think i need to do a nested while loop thing but cant figure out how to set the stuff all up.
If anyone can point me in the right direction and help me out it would be greatly appreciated!!