CHALLENGE 42.3: Basic while laop expression. Write while loom that prints userNu
ID: 3146322 • Letter: C
Question
CHALLENGE 42.3: Basic while laop expression. Write while loom that prints userNum divided by 2 (integer division until reaching 1 oulpul for userNurT40 ollow each number by a space Example 20 10 5 21 Note: These activities may test code with different test values. This activity will perform four tests, with usetum-40, then with userNu -2, then with userNum -0, then with userNun1. See How to Use zyHooks. Also note: If the submitted code has an infinite lcop, the system will stop running the code after a few scconds, and report Programend never reached. The system doesn't print the test case that caused the reported message. int nin) int uscrNun -e 7UrNun-40: ,. Your solution goes here 11 CCcut endi return 1:08 AM 10/25/2017 Search the web and WindowsExplanation / Answer
# include <iostream>
using namespace std;
int main(){
int userNum = 0;
userNum = 40;
while(userNum > 1){
userNum = userNum / 2;
cout << userNum << " ";
}
cout << endl;
return 0;
}