Advertisement
pablosotol

Guia Programacion 1 - Ejercicio 3

Mar 26th, 2015
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.26 KB | None | 0 0
  1. #include <stdio.h>
  2. int main(){
  3.     int n,x;
  4.     do{
  5.        printf("\nIngrese un numero distinto de 1: ");
  6.        scanf("%d",&n);
  7.        if(n%2==0){
  8.        n=n/2;
  9.        }
  10.        else{
  11.        n=n*3+1;
  12.        }
  13.        printf("%d",n);
  14.     }while(n!=1);
  15.  
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement