/* Program: Lap 7 Author: Chi Tat Leung Class:CSCI 110 Date: 10/8/03 Description: Relational and Logical Operators I certify that: - All code used in my program is either my original work or was modified by me from the source code published in the text of this course or provided by my instructor. - I have not used code obtained from another student, or any other unauthorized source, either modified or unmodified. - I have not discussed or shared coding details of this program with anyone other than my instructor or MT. SAC tutors. I understand that I may discuss the concepts/ideas of this program with other students as long as we do not get down to the coding details. */ #include int main() { int x, y, a, b, c; x = 1; y = 5; printf("Part 1\n"); printf("\n"); printf("x < y: %d\n", x < y); printf("x <= y: %d\n", x <= y); printf("x > y: %d\n", x > y); printf("x >= y: %d\n", x >= y); printf("x == y: %d\n", x == y); printf("x != y: %d\n", x != y); printf("\n"); printf("-----------------\n"); printf("\n"); a = 0; b = 1; c = 5; printf("Part 2\n"); printf("\n"); printf("a && b: %d\n", a && b); printf("a || b: %d\n", a || b); printf(" !a : %d\n", !a); printf(" !b : %d\n", !b); printf(" !c : %d\n", !c); printf(" !!c : %d\n", !!c); printf("\n"); printf("-----------------\n"); printf("\n"); x = 7; /*incorrec*/ printf("Part 3\n"); printf("\n"); if(0 <= x <= 5) printf("x is in the range\n"); else printf("x is not in the range\n"); printf("\n"); x = 1; if(0 <= x <= 5) printf("x is in the range\n"); else printf("x is not in the range\n"); printf("\n"); return 0; }