Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main ()
- {
- int x;
- int i=0;
- printf ("Podaj X: ");
- scanf ("%d",&x);
- while(x!=1){
- if(x%2==0) {
- x=x/2;
- i++;
- }
- else {
- x=3*x+1;
- i++;
- }
- }
- printf ("Liczba operacji %d",i);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement