Skip to content

section4_exercises

Fábio Gaspar edited this page Jan 18, 2019 · 2 revisions

Exercises

  1. Write a program that asks for the radius of a circumference and calculates the area and perimeter.
Radius? 2

Area = ...
Perimeter = ...

Tip: For PI constant value, you can declare a variable and assign 3.1415926 (the result doesn't need to be very precise, so this is good enough).

  1. Write a program that converts a temperature in Celsius to Fahrenheit. 1F = 1C × 1.8 + 32
Temperature (Celsius) ? 

Temperatura in Fahrenheit is ...
  1. Write a program that reads an amount of time, in seconds, and displays the equivalent in days, hours, minutes and seconds.
How many seconds? 112666
1 days, 7 hours, 17 minutes and 46 seconds