C_dumping-ground/3x+1andfriends.c

20 lines
354 B
C
Raw Normal View History

#include <stdio.h>
char *libz_atoi(char *dicks);
int main() {
char *dicks = "!123";
long x = 76;
while(x != 1) {
if(x % 2 == 0) {
x /= 2;
}
else {x = (x * 3) + 1;}
printf("%ld\n", x);
}
printf("%s\n", dicks);
char *dick2 = libz_atoi(dicks);
printf("%d\n", dick2);
return 0;
}