fork download
  1. int k = n;
  2. for(n=i;n<=j;n++)
  3. {
  4. while(k!=1)
  5. {
  6. ++sum;
  7. if(k%2!=0){k=3*k+1;}
  8. else {k=k/2;}
  9. }
  10. if(sum>max){max=sum;}
  11.  
  12. sum=1;
  13. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:9: error: ‘n’ was not declared in this scope
 int k = n;
         ^
prog.cpp:2:1: error: expected unqualified-id before ‘for’
 for(n=i;n<=j;n++)
 ^~~
prog.cpp:2:9: error: ‘n’ does not name a type
 for(n=i;n<=j;n++)
         ^
prog.cpp:2:14: error: ‘n’ does not name a type
 for(n=i;n<=j;n++)
              ^
stdout
Standard output is empty