Skip to main content

Celsius to Fahrenheit Conversion

Problem Description​

Given a temperature in celsius C. You have to convert it in Fahrenheit.

Examples​

Example 1:

Input: 
C = 32

Output:
89.60

Explanation:
For 32 degree C temperature
in farenheit = 89.60

Example 2:

Input: 
C = 25

Output:
77.00

Explanation:
For 25 degree C temperature
in farenheit = 77.

Constraints​

  • 1 ≀ C ≀ 100000

Solution for Celsius to Fahrenheit Conversion​

Code in Different Languages​

Written by @vansh-codes
 class Solution:
def celciusToFahrenheit(self, C: int) -> float:
# code here
return C * 9 / 5 + 32

# Example usage
solution = Solution()
print(solution.celciusToFahrenheit(0)) # 32.0
print(solution.celciusToFahrenheit(100)) # 212.0

References​