Tuesday, August 9, 2011

Chapter 3, exercise 3

3.  Write declarations for these variables.

a.  A person's age to the nearest year.

unsigned char age;

b.  A person's weight in pounds.

unsigned short weight;

c.  The radius of a circle.

float radius;

d.  Your annual salary.

float salary;

e.  The cost of an item.

float price;

f.  The highest grade on a test (assume it is always 100).

unsigned char grade;

g.  The temperature.

float temperature;

h.  A person's net worth.

float net_worth;

i.  The distance to a star in miles.

float distance;

No comments:

Post a Comment