Advertisement
paulogp

Ano bissexto

Jul 13th, 2011
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.46 KB | None | 0 0
  1. // apple Xcode
  2. // paulogp
  3. #include <stdio.h>
  4.  
  5. #define macro_bissexto(the_x) ((the_x) % 4 == 0 && (the_x) % 100 != 0 || (the_x) % 400 == 0)
  6.  
  7. int main (int argc, const char * argv[]) {
  8.     /* ano bissexto
  9.      retorna 1 se sim, 0 se nao */
  10.     int the_year = 0;
  11.  
  12.     printf("ano: ");
  13.     scanf("%i", &the_year);
  14.  
  15.     int the_result = macro_bissexto(the_year);
  16.  
  17.     if (the_result == 1) {
  18.         printf("Bissexto\n");
  19.     } else {
  20.         printf("Nao e bissexto\n");
  21.     }
  22.  
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement