C# Program to Convert Centigrade to Fahrenheit

C# program to convert centigrade to fahrenheit can be implemented by using following formula

$F = 32+\frac{9*C}{5}$

Here, value of $F$ is the temperature in fahrenheit while $C$ is the temperature in centigrade.

Fahrenheit and Centigrade are two well known temperature scales. Both of them are used regularly in daily temperature measurements. By using above formula, the following C# program produces output in fahrenheit ($^{\circ}F$) while taking centigrade ($^{\circ}C$) as input.

1. C# Program & output to convert centigrade to fahrenheit

Code has been copied
 C# program to convert Centigrade To Fahrenheit 

using System;

namespace CentigradeToFahrenheit
    class Program
        static void Main(string[] args)
            // declare variables
            double f,c;
            //take input in centigrade
            Console.Write("Enter the temperature in centigrade = ");
            c = Convert.ToDouble(Console.ReadLine());
            //convert Centigrade to Fahrenheit
            // display result
            Console.WriteLine("Temperature is "+f+" in fahrenheit When "+c+" in centigrade.");

            // wait for user to press any key


Enter the temperature in centigrade = 100

Temperature is 212 in fahrenheit When 100 in centigrade.

No comments:

Post a Comment

If you have any doubts or suggestions, please leave a note.