Beginner Level

Implement the method celsiusToFahrenheit that converts Celsius to Fahrenheit.

Convert a Celsius temperature into Fahrenheit using F = C * 9 / 5 + 32. The result can contain a decimal part.

The task is designed to test careful handling of edge cases, not only the most common input.

  • Accept negative, zero, and positive temperatures.
  • Use floating-point arithmetic for the division.
  • Return the converted temperature without unnecessary rounding.

Example 1

Input
c (double) = 0
Returns (double) 32

Example 2

Input
c (double) = 100
Returns (double) 212

Example 3

Input
c (double) = -40
Returns (double) -40

Example 4

Input
c (double) = 37
Returns (double) 98.6

Multiply the Celsius value by 9, divide by 5, and add 32. In languages with integer division, force floating-point arithmetic.

Ready to test your solutionRun Code checks your solution against the test cases.Shift + Enter to run

Notifications

Updates are enabled for this browser.

Receive new tutorials, articles and learning resources. You can turn updates off anytime.

Test browser code

Use this code in admin to send a test notification to this browser.