5.14 Programming Exercises
Exercise 5-1: Write a program that converts Celsius to Fahrenheit. The formula is
F = 9/5C + 32.
Exercise 5-2: Write a program to calculate the volume of a sphere,
4/3 r3.
Exercise 5-3: Write a program to print out the perimeter of a rectangle given its
height and width.
perimeter = 2 · (width + height)
Exercise 5-4: Write a program that converts kilometers per hour to miles per hour.
miles = (kilometers · 0.6213712)
Exercise 5-5: Write a program that takes hours and minutes as input and outputs the
total number of minutes (e.g., 1 hour 30 minutes = 90 minutes).
Exercise 5-6: Write a program that takes an integer as the number of minutes and
outputs the total hours and minutes (e.g., 90 minutes = 1 hour 30
minutes).
|