I think a silly syntax error then; i post the code..
Code:#include <stdio.h> #include <stdlib.h> main() { int n; int step=0; scanf("%d",&n); if(n==1)return 0; if (n%2==0){ n=n/2; step++; else n=3*n+1; step++;} printf("%d",step); return 0; }
i get back from gcc:
' error: syntax error before "else" '
then, the error stands in 'step++', i guess.. but don't know how to tweak it.. i need the function add +1 to 'step' for both cases, even and odd inputs.
any clue? thanks to all