Write a C# code to Perform Celsius to Fahrenheit Conversion and Fahrenheit to Celsius conversion.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace program
{
    class Program
    {
        static void Main(string[] args)
        {
            int celsius, faren;

            Console.WriteLine("Enter Temperature in Celsius(°C) : ");
            celsius = int.Parse(Console.ReadLine());
            faren = (celsius * 9) / 5 + 32;
            Console.WriteLine("Temperature in Fahrenheit is(°F) : " + faren);
            Console.ReadLine();

            double cel;
            Console.Write("Enter Temperature in Fahrenheit(°F) : ");
            double fahrenheit = Convert.ToDouble(Console.ReadLine());
            cel = (fahrenheit - 32) * 5 / 9;
            Console.WriteLine("Temperature in Celsius is(°C): " + cel);
            Console.ReadLine();
       }
    }
}

Output:
Enter Temperature in Celsius(°C) :65
Temperature in Fahrenheit is(°F) : 149

Enter Temperature in Fahrenheit(°F) : 149

Temperature in Celsius is(°C): 65

Popular posts from this blog

Write a program to check whether empty query string is entered in Asp.Net.

Mandavrayji Temple, Muli, Surendranagar, Gujarat

Write a program to change color of Label text control programmatically in Asp.Net.