- #1
Maybe_Memorie
- 353
- 0
Homework Statement
Simulate the following program
#include <stdio.h>int xxx ( int n )
{
if ( n < 10 ) /* A */
return 0;
else
return 1 + xxx ( n/10 ); /* B */
}
main()
{
printf ( "xxx(333)=%d\n", xxx(333) );
}
Homework Equations
The Attempt at a Solution
I'm not sure if this is correct but here's what I have
xxx(333) = 1 + xxx(33)
xxx(33) = 1 + xxx(3)
xxx(3) = 0
xxx(33) = 1 + 0 = 1
xxx(333) = 1 + 1 = 2