Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  samplecode
Language: C/C++
Code:
#include <stdio.h>
int main()
{
int i, x, y, array[1000000], max=array[0], num;
for(i=1; i<1000000; i++)
{
for(y=0, num=0; y!=1; num++)
{
if(x%2==0)
{
y=y+x/2;
}
else if(x%2==1)
{
y=y+3*x+1;
}
x=y;
y=0;
}
array[i]=num;
}
for(i=1;i<1000000;i++)
{
if(array[i]>max)
{
max=array[i];
}
}
Printf("The number with largest chain is", max );
}     
Comments: