CJCoding With Joseph
← Back to Question List
C# Code Walkthrough #34

Halving in a While Loop

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