C# Program to Convert Celsius to Fahrenheit


This is a C# Program to perform celsius to fahrenheit conversion.

Problem Description

This C# Program Performs Celsius to Fahrenheit Conversion.

Problem Solution

Here the temperature is obtained in Celsius and is converted to Fahrenheit.

Program/Source Code

Here is source code of the C# program to perform Celsius to Fahrenheit conversion. The C# program is successfully compiled and executed with Microsoft Visual Studio. The program output is also shown below.

 * C# Program to Perform Celsius to Fahrenheit 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 the Temperature in Celsius(°C) : ");
            celsius = int.Parse(Console.ReadLine());
            faren = (celsius * 9) / 5 + 32;
            Console.WriteLine("0Temperature in Fahrenheit is(°F) : " + faren);
Program Explanation

In this C# program, we are reading the temperature in celsius(°c) using ‘celsius’ variable. Multiply the value of ‘Celsius’ variable with 9 and add the resulted value with the value of 5. Again add the resulted value with the value of 32. Print the Fahrenheit value of the celsius.

Note: Join free Sanfoundry classes at Telegram or Youtube
Runtime Test Cases
Enter the Temperature in Celsius (°C) :  20
Temperature in Fahrenheit(°F)  is  : 68

Sanfoundry Global Education & Learning Series – 1000 C# Programs.

If you wish to look at all C# Programming examples, go to 1000 C# Programs.

Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.