You are on page 1of 1

The Institute of Finance Management

Faculty of Computing Information Systems and Mathematics - FCIM


Department of Computer Science
Programming in C CSU07202 – BIT 1 & BCS 1
Tutorial IV

1. There are approximately 3.156 × 10 7 seconds in a year. Write a program that requests your age
in years and then displays the equivalent number of seconds.
2. The mass of a single molecule of water is about 3.0×10 -23 grams. A quart of water is about 950
grams. Write a program that requests an amount of water, in quarts, and displays the number of
water molecules in that amount.
3. There are 2.54 centimeters to the inch. Write a program that asks you to enter your height in
inches and then displays your height in centimeters. Or, if you prefer, ask for the height in
centimeters and convert that to inches.
4. In the U.S. system of volume measurements, a pint is 2 cups, a cup is 8 ounces, an ounce is 2
tablespoons, and a tablespoon is 3 teaspoons. Write a program that requests a volume in cups and
that displays the equivalent volumes in pints, ounces, tablespoons, and teaspoons. Why does a
floating-point type make more sense for this application than an integer type?
5. Write a program that converts time in minutes to time in hours and minutes. Use #define or const
to create a symbolic constant for 60. Use a while loop to allow the user to enter values repeatedly
and terminate the loop if a value for the time of 0 or less is entered.
6. Write a program that asks the user to enter the number of days and then converts that value to
weeks and days. For example, it would convert 18 days to 2 weeks, 4 days. Display results in the
following format: 18 days are 2 weeks, 4 days. Use a while loop to allow the user to repeatedly
enter day values; terminate the loop when the user enters a nonpositive value, such as 0 or -20.

You might also like