Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int a,b,i,n,j,c=0,max=0;
- while(scanf("%d %d",&a,&b)!=EOF)
- {
- if(n>0 && n<10000)
- {
- for(i=a; i<=b; i++)
- {
- n=i;
- while(1)
- {
- if(n==1)
- {
- c++;
- break;
- }
- else if(n%2!=0)
- {
- n=(3*n)+1;
- c++;
- }
- else if(n%2==0)
- {
- n=n/2;
- c++;
- }
- }
- if(c>max)
- {
- max=c;
- }
- c=0;
- }
- printf("%d %d %d\n",a,b,max);
- max=0;
- c=0;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement