Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
Collatz(3k+1)
#include <stdio.h> #include <stdlib.h> #include <time.h> int main(void) { unsigned int n; time_t t; srand((unsigned) time(&t)); n = rand() / 3; if (n > 1) { while (n > 1) { printf("%10u \n", n); if ((n % 2) == 0) { n = n / 2; if (n == 1) printf("%10u", n); } else n = 3 * n + 1; } } else printf("%u", n); return 0; }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Replacing Evens and Odd with ones and zeroes in a 3-Dimensional array
Warnings
19_1
20171127_ARRAY_ValorMayor
Présentation
lab 11 v0.7
Hello w
LECTURA DE CADENAS CON FGETS
SUDOKUS CORRECTOS
MATRICES TRIANGULARES
Please log in to post a comment.