Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <stdio.h>
- #include <stdlib.h>
- int main() {
- int x;
- scanf("%d", &x);
- while (x != 0) {
- int kwiaty = 0, liscie = 0, i ;
- for ( i = 0; i < 15; i++) {
- if (x % 2 == 0) {
- x /= 2;
- kwiaty++;
- }
- else if (x == 1) {
- break;
- }
- else {
- x = 3 * x + 1;
- liscie++;
- }
- i++;
- }
- if (x == 1) {
- printf("TAK %d %d\n", kwiaty, liscie);
- }
- else if (x != 1) {
- printf("NIE\n");
- }
- scanf("%d", &x);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement