Programmation Avancée en C


decla2.c

00001 #include <stdio.h>
00002 
00003 int main()
00004 {
00005     int x, y;
00006     printf("x = ");  scanf("%d", &x);
00007     printf("y = ");  scanf("%d", &y);
00008     printf("x + y  = %d\n", x + y);
00009     printf("x - y  = %d\n", x - y);
00010     printf("x * y  = %d\n", x * y);
00011     if(y != 0) /* on ne peut pas diviser par 0 */
00012             printf("x / y  = %d\n", x / y);
00013     printf("x <= y = %d\n", x <= y);
00014     printf("x >= y = %d\n", x >= y);
00015     printf("x == y = %d\n", x == y);
00016     printf("x != y = %d\n", x != y);
00017     printf("x && y = %d\n", x && y);
00018     printf("x || y = %d\n", x || y);
00019     printf("  !x   = %d\n", !x);
00020     printf("x & y  = %d\n", x & y);
00021     printf("x | y  = %d\n", x | y);
00022     printf("x ^ y  = %d\n", x ^ y);
00023     printf("  ~x   = %d\n", ~x);
00024     printf("x << 2 = %d\n", x << 2);
00025     printf("x >> 2 = %d\n", x >> 2);
00026     return 0;
00027 }