-
Write a program to read in 3 integers and print their sum.
-
Write a program to read in two integers and display both the quotient and the remainder when they are divided. How does your computer treat the results of division by a negative number? What happens when you try and divide by zero?
-
What error message does your compiler give when you write
x+1=x
in a program?
-
Write a program to test the behaviour of your computer system when it processes
printf("%d %d\n",x++,++x);
-
How do you think the computer will evaluate
x+=x++
Try and calculate the value for a particular value of x, then write a program to see what really happens. Do you think any other computer might come up with a different result?
-
Does
x-=x
make any sense? What do you think it means?
-
How would
x%y%z
be evaluated? Write a program to find out what happens.
-
Write a program to read in two integers and display one as a percentage of the other. Typically your output should look like
20 is 50% of 40
assuming that the numbers read in where 20 and 40