Temperature converter

Temperature converter

Input Centigrade and output Fahrenheit.

Fahrenheit was once the main scale used in England and is still widely used in America, although the founding fathers thought about adopting the metric system instead. Around 1965, Britain began switching towards the metric system.

Make


Write a program that converts between Centigrade and Fahrenheit.

Use this boilerplate code as a starting point:

Success Criteria

Remember to add a comment before a subprogram to explain its purpose.

Complete the subprogram called `c_to_f` so that:

  1. It returns the Fahrenheit calculated as Centigrade multiplied by 1.8 plus 32.

Complete the `main program` so that:

  1. Line 12 should allow the user to input Centigrade as an integer.
  2. Line 13 should call the c_to_f subprogram.

Typical inputs and outputs from the program would be:

Enter the temperature in Centigrade: 30

30 degrees Centigrade is 86.0 degrees Fahrenheit.

Knowledge Organiser

Use these resources as a reference to help you meet the success criteria.

Programming guide:

Evaluate


Run the unit tests below to check that your program has met the success criteria.

Enter the temperature in Centigrade: -5

-5 degrees Centigrade is 23.0 degrees Fahrenheit.

Enter the temperature in Centigrade: 30

30 degrees Centigrade is 86.0 degrees Fahrenheit

Enter the temperature in Centigrade: 0

0 degrees Centigrade is 32.0 degrees Fahrenheit.

Check that you have used comments within the code to describe the purpose of subprograms.