#28471: 很簡單的


alex950301 (alex0301)


 

void f( int n ) {

x = 0 ;

while( n != 1 ) {

if( n % 2 == 0 ) {

n = n / 2 ;

x++ ;

}

if( n > 1 && n % 2 == 1 ) {

n = n * 3 + 1 ;

x++ ;

}

}

}

很基本的if while 條件 

把他用個void 看起來很厲害