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