Advertisement
campos20

Par ou Impar

May 2nd, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. // Classificacao em par ou impar
  6. // Autor: Alexandre Campos
  7.  
  8. int main()
  9. {
  10. // Declaracao
  11. int numero, resto;
  12.  
  13. // Entrada de dados
  14. printf("Digite um numero:\n");
  15. scanf("%d", &numero);
  16.  
  17. // Logica
  18. resto = numero % 2;
  19.  
  20. // Saida na tela
  21. if (resto == 0){
  22. printf("%d e par\n", numero);
  23. } else {
  24. printf("%d e impar\n", numero);
  25. }
  26.  
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement