#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void c(int n){
if(n==1) return;
if(n%2 == 0){
printf("%d ", n/2);
c(n/2);
}else {
printf("%d ", 3*n+1);
c(3*n+1);
}
}
int main() {
int n;
scanf("%d", &n);
printf("%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: