Latest Post

Sunday, 1 January 2017

How to Convert Fahrenheit into Centigrade [C#]

Write a program in C# that accepts the temperature in Fahrenheit and converts into Centigrade..

Following is the simple C# code :


class Lab
    {
        static void Main(string[] args)
        {

            int tempInCelsius, tempInFaren;
            Console.WriteLine("Enter the Temperature in Fahrenheit is(°F): ");
            tempInFaren = int.Parse(Console.ReadLine());

            tempInCelsius = (tempInFaren - 32) * 5 / 9;
            Console.WriteLine("Temperature in Celsius(°C) : " + tempInCelsius);
            Console.ReadLine();

        }
    }

Output:-



Government Jobs