Write a program that converts temperatures between Celsius and Fahrenheit. You'll implement two functions:
CelsiusToFahrenheit- converts a temperature from Celsius to Fahrenheit.FahrenheitToCelsius- converts a temperature from Fahrenheit to Celsius.
func CelsiusToFahrenheit(celsius float64) float64
func FahrenheitToCelsius(fahrenheit float64) float64- A float64 temperature value in either Celsius or Fahrenheit.
- A float64 temperature value converted to the other unit.
- Celsius to Fahrenheit: F = C × 9/5 + 32
- Fahrenheit to Celsius: C = (F - 32) × 5/9
CelsiusToFahrenheit(0)
32.0
FahrenheitToCelsius(32)
0.0
CelsiusToFahrenheit(100)
212.0
- Round the result to 2 decimal places
- Handle negative temperatures correctly
- The functions should work with any valid temperature value
- Fork the repository.
- Clone your fork to your local machine.
- Create a directory named after your GitHub username inside
challenge-18/submissions/. - Copy the
solution-template.gofile into your submission directory. - Implement the required functions.
- Test your solution locally by running the test file.
- Commit and push your code to your fork.
- Create a pull request to submit your solution.
Run the following command in the challenge-18/ directory:
go test -v