C EXPRESSION EXERCISES
1. What is the difference between
x = y;
and
y = x;
2. What do the following C statements do?
t = x; x = y; y = t;
3. What is wrong with the following C statements?
A. if (a > b) then c = 0;
B. if a > b { c = 0; }
C. if (a > b) c = 0;
D. if (a > b) c = 0 else b = 0;
4. Write a C program that reads in three integers and prints
"equal" if all three are equal, and "not equal" otherwise.
5. Write a C program that reads in an integer and prints "leap
year" if it is a leap year, and "regular year" otherwise.
Recall a year is a leap year if it is divisible by 400, or if
is divisible by 4 but not 100.
6. What does the following program print.
#include <stdio.h>
#define SIX 1+5
#define NINE 8+1
int main(void) {
printf("%d * %d = %d\n", SIX, NINE, SIX * NINE);
return 0;
}