CJCoding With Joseph
15free / daySign inCreate account
Back to Code Walkthrough

Halving in a While Loop

C# code walkthrough · Question 34
easyLoops

Code

Read carefully. What does this print?
1int n = 16;
2int count = 0;
3while (n > 1)
4{
5 n /= 2;
6 count++;
7}
8Console.WriteLine(count);

Your answer