Do the following exercises using only the material we have studied in Module 1. In particular, you may not make use of the if statement or the ternary operator.Some of the questions are a bit tricky. The idea is to stretch some on these problems, so that you will find the quiz and exam questions easier to tackle. The quiz and associated exam problems will resemble the questions you see here, so work to master these and you should have no problem on the quiz or exam.
Where there are multiple exercises within a problem, choose one or two and leave the rest for homeowork on your own.
For example, if cost has the value 12345, then your program should print $123.45.
Hint: An assignment of the form (a=b) is itself an expression with the value b. The expression assigns the value of b to a, and then evaluates to the value of b.
Value | int? | double? |
---|---|---|
Area of a circle | ||
Number of robots you own | ||
Your graduation year | ||
Your height in meters | ||
Your weight in micrograms | ||
Number of facebook friends | ||
Average age of your facebook friends |