7
Ecrire une commande
- #include <stdlib.h>
- #include <stdio.h>
- int main( int argc, char *argv[] ) {
- int y;
- switch ( argc ) {
- case 2:
- y = atoi( argv[1] );
- printf( (y % 4 == 0 && y % 100 != 0 || y % 400 == 0) ? "yes" : "no" );
- printf( "\n" );
- break;
- default:
- printf( "%s year\n", argv[0] );
- exit(1);
- }
- exit(0);
- }
$ gcc -o bissex bissex.c
$ ./bissex
./bissex year
$ ./bissex 1961
no
$ ./bissex 1984
yes
$ ./bissex 2000
yes
$ ./bissex 1900
no
Commentaires