#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void c(int n){
if(n==1){
printf("%d ", 1);
return;
}
if(n%2 == 0) c(n/2);
else c(3*n+1);
printf("%d ", n);
}
int main() {
int n;
scanf("%d", &n);
c(n);
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: