- #1
Maybe_Memorie
- 353
- 0
Homework Statement
Simulate the following program
#include <stdio.h>
int xxx (int n)
{
int count;
count = 0;
while ( n >=2)
{
n = n/2;
++count;
}
return count;
}
main()
{
printf( "xxx(17)=%d\n", xxx(17) );
}
Homework Equations
The Attempt at a Solution
Is this correct?
n, count
17 0
8 1
4 2
2 3
1 4
Return 4, 4 gets printed