MaXwEllDeN

Untitled

Jun 16th, 2013
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | None | 0 0
  1. #include <iostream.h>
  2.  
  3. bool isPair(int numero){
  4.    return numero % 2 == 0;
  5. }
  6. bool isImpar(int numero){
  7.    return numero % 2 != 0;
  8. }
  9.  
  10. int main(int argc, char * argv[])
  11. {
  12.    int aux;
  13.    for (int a = 1; a <= 20; a++){
  14.       printf("\nDigite um numero: ");
  15.       scanf("%d", &aux);
  16.  
  17.       if (isPair(aux))
  18.             printf("O numero %d e par.\n", aux);
  19.       else
  20.             printf("O numero %d e impar.\n", aux);      
  21.    }
  22.  
  23.    return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment