Users Online

· Guests Online: 144

· Members Online: 0

· Total Members: 188
· Newest Member: meenachowdary055

Forum Threads

Newest Threads
No Threads created
Hottest Threads
No Threads created

Latest Articles

C# Program to Convert Celsius to Fahrenheit

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);
            Console.ReadLine();
 
        }
    }
}
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.

 
Runtime Test Cases
 
Enter the Temperature in Celsius (°C) :  20
Temperature in Fahrenheit(°F)  is  : 68

Comments

No Comments have been Posted.

Post Comment

Please Login to Post a Comment.

Ratings

Rating is available to Members only.

Please login or register to vote.

No Ratings have been Posted.
Render time: 0.89 seconds
10,813,203 unique visits