All challenges
Easy 0 solved 0% acceptance

Celsius to Fahrenheit

Convert a temperature from Celsius to Fahrenheit.

Problem

Convert a temperature in degrees Celsius to degrees Fahrenheit using F = C × 9 / 5 + 32.

Implement celsius_to_fahrenheit(celsius).

Input

celsius: The temperature in degrees Celsius.

Output

Return the temperature in degrees Fahrenheit (a decimal number).

Constraints

-273.15 ≤ celsius ≤ 10,000

Examples

Example 1
Input:
celsius = 100.0

Expected output:
expected = 212.0
Input:
double celsius = 100.0;

Expected output:
double expected = 212.0;
Input:
double celsius = 100.0;

Expected output:
double expected = 212.0;

Explanation

100 × 9 / 5 + 32 = 212, the boiling point of water.

Example 2
Input:
celsius = -40.0

Expected output:
expected = -40.0
Input:
double celsius = -40.0;

Expected output:
double expected = -40.0;
Input:
double celsius = -40.0;

Expected output:
double expected = -40.0;

Explanation

-40 × 9 / 5 + 32 = -40: both scales meet at -40.

References

This challenge is adapted for CodeUtility. Follow the statement and constraints above.

Learn from others

Community solutions

No published solutions yet. Solve this challenge to share the first one.