Relational and logical operations
#include <stdio.h>
int main(void)
{
int i, j;
printf("Enter i: ");
scanf("%d", &i);
printf("Enter j: ");
scanf("%d", &j);
/* relational operations */
printf("i < j %d\n", i < j);
printf("i <= j %d\n", i <= j);
printf("i == j %d\n", i == j);
printf("i > j %d\n", i > j);
printf("i >= j %d\n", i >= j);
/* logical operations */
printf("i && j %d\n", i && j);
printf("i || j %d\n", i || j);
printf("!i !j %d %d\n", !i, !j);
return 0;
}
Related examples in the same category