#include<stdio.h>
#include<stdlib.h>
#include<math.h>
main(){
int n,a=3,i,t[100];;
printf("entre n:\n");
scanf("%d",&n);
printf("entre a:\n");
scanf("%d",&a);
t[0]=a;
for(i=0;t[i]!=1;i++){
printf("u(%d):%d\n",i,t[i]);
if(t[i]%2==0){
t[i+1]=t[i]/2;
}
else t[i+1]=3*t[i]+1;
}printf("u(%d):%d\n",i+1,1);
system("pause");
}
#include<stdlib.h>
#include<math.h>
main(){
int n,a=3,i,t[100];;
printf("entre n:\n");
scanf("%d",&n);
printf("entre a:\n");
scanf("%d",&a);
t[0]=a;
for(i=0;t[i]!=1;i++){
printf("u(%d):%d\n",i,t[i]);
if(t[i]%2==0){
t[i+1]=t[i]/2;
}
else t[i+1]=3*t[i]+1;
}printf("u(%d):%d\n",i+1,1);
system("pause");
}