Tutorialspoint
Problem
Solution
Submissions

Convert Celsius to Fahrenheit

Certification: Basic Level Accuracy: 62.5% Submissions: 16 Points: 5

Write a C# program that converts a temperature in Celsius to Fahrenheit.

Example 1
  • Input: celsius = 0
  • Output: 32.0
  • Explanation:
    • Step 1: Apply the conversion formula: F = (C × 9/5) + 32.
    • Step 2: Substitute C = 0: F = (0 × 9/5) + 32 = 0 + 32 = 32.0.
    • Step 3: Return the result as 32.0 degrees Fahrenheit.
Example 2
  • Input: celsius = 37
  • Output: 98.6
  • Explanation:
    • Step 1: Apply the conversion formula: F = (C × 9/5) + 32.
    • Step 2: Substitute C = 37: F = (37 × 9/5) + 32 = 66.6 + 32 = 98.6.
    • Step 3: Return the result as 98.6 degrees Fahrenheit.
Constraints
  • -273.15 ≤ celsius ≤ 10^6 (temperature above absolute zero)
  • Time Complexity: O(1)
  • Space Complexity: O(1)
NumberBooleanMathematicalCapgeminiEY
Editorial

Login to view the detailed solution and explanation for this problem.

My Submissions
All Solutions
Lang Status Date Code
You do not have any submissions for this problem.
User Lang Status Date Code
No submissions found.

Please Login to continue
Solve Problems

 
 
 
Output Window

Don't have an account? Register

Solution Hints

  • Use the formula: fahrenheit = (celsius * 9/5) + 32
  • Use lambda function: convert = lambda c: (c * 9/5) + 32
  • Use multiplication by 1.8 instead of 9/5: fahrenheit = (celsius * 1.8) + 32

Submitted Code :