hey hi,

you can take the help of this code and modify it..

Its made in Dev-C++ and thus not standard linux code.

#include <stdio.h>

int main()
{
    int x , n , m, y, i ,max;
    int count;
    int arr[100000];
    max = 0;

    printf("press 0 to exit\n");

    while (1){

    scanf("%d%d" , &m, &n);
    i = m;

    if (m == 0){
          break;
          }
    while(  i<=n ){
          count = 1;

      //  printf("%d\n", i);
          y = i;

         while (y != 1 ){
               if ( y == 1 ){
                    break;
               }

               if ( y& 1 ){
                    y= 3*y+1;
               }else{
                    y = y/2;
               }
               count++;
         }



        if (max < count){
                max = count;
        }

        i++;

        }

        printf("%d\n" , max);
        max = 0;
        }
        system("pause");
}

-- 
You received this message because you are subscribed to the Google Groups 
"google-codejam" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en.

Reply via email to