Skip to content
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.

Latest commit

 

History

History
69 lines (46 loc) · 1.45 KB

File metadata and controls

69 lines (46 loc) · 1.45 KB

Description

Welcome to DailyProgrammer University. Today you will be earning a degree in converting degrees. This includes Fahrenheit, Celsius, Kelvin, Degrees (angle), and Radians.

Input Description

You will be given two lines of text as input. On the first line, you will receive a number followed by two letters, the first representing the unit that the number is currently in, the second representing the unit it needs to be converted to.

Examples of valid units are:

  • d for degrees of a circle
  • r for radians

Output Description

You must output the given input value, in the unit specified. It must be followed by the unit letter. You may round to a whole number, or to a few decimal places.

Challenge Input

3.1416rd
90dr

Challenge Output

180d
1.56r

Bonus

Also support these units:

  • c for Celsius
  • f for Fahrenheit
  • k for Kelvin

If the two units given are incompatible, give an error message as output.

Bonus Input

212fc
70cf
100cr
315.15kc

Bonus Output

100c
158f
No candidate for conversion
42c

Notes

  • See here for a wikipedia page with temperature conversion formulas.
  • See here for a random web link about converting between degrees and radians.

Finally

Have a good challenge idea? Consider submitting it to /r/dailyprogrammer_ideas