Advertisement
d3dx939dll

Aula18 - Exercicio (#2)

Dec 21st, 2020
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.66 KB | None | 0 0
  1. /*
  2. Aula: Exercicio (#18)
  3. Data: 22/12/2020
  4. Link: https://www.youtube.com/watch?v=nipW-60w9KY&t=188s
  5. */
  6. #include <stdio.h>
  7. int main()
  8. {
  9.     int numero, cifra;
  10.  
  11.     printf("Digite um numero inteiro: ");
  12.     scanf("%i", &numero);
  13.  
  14.     if (numero >= 0){
  15.         do{
  16.           cifra = numero % 10;
  17.           printf("%i", cifra);
  18.           numero /= 10;
  19.         } while (numero != 0);
  20.         printf("\n");
  21.     }
  22.     else if (numero < 1){
  23.      numero = numero * -1;
  24.  
  25.      printf("-");
  26.  
  27.      do{
  28.         cifra = numero % 10;
  29.         printf("%i", cifra);
  30.         numero /= 10;
  31.       }while (numero != 0);
  32.  
  33.       printf("\n");
  34.     }
  35.  
  36.     return 0;
  37. }
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement