Author : Rahul
Write a program to convert temperature from Celsius to Fahrenheit.
Program
using System;
namespace ProgrammingQuestion
{
class Program
{
static void Main(string[] args)
{
//Variable Declaration
string temperatureCelVal;
double temperatureCel, temperatureFah;
//User Input
Console.Write("Enter Temperature (in Celsius):");
temperatureCelVal = Console.ReadLine();
temperatureCel = Convert.ToDouble(temperatureCelVal);
//Temperature Conversion Logic
temperatureFah = ((temperatureCel * 9) / 5) + 32;
//Print Result
Console.WriteLine($"Temperature (in Fahrenheit): {temperatureFah}");
Console.Read();
}
}
}
Output
Enter Temperature (in Celsius):15.5
Temperature (in Fahrenheit): 59.9