Please note, this is a STATIC archive of website www.w3resource.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
w3resource

C# Sharp Exercises: Program to convert from celsius degrees to Kelvin and Fahrenheit

C# Sharp Basic: Exercise-14 with Solution

Write a C# Sharp program to convert from celsius degrees to Kelvin and Fahrenheit.
kelvin = celsius + 273
fahrenheit = celsius x 18 / 10 + 32

C# Sharp Exercises: Program to convert from celsius degrees to Kelvin and Fahrenheit

Sample Solution:

C# Sharp Code:

using System;
public class Exercise14
{
   public static void Main( )
    {
        Console.Write("Enter the amount of Celsius: "); 
        int celsius = Convert.ToInt32(Console.ReadLine());
 
        Console.WriteLine("Kelvin = {0}", celsius + 273);
        Console.WriteLine("Fahrenheit = {0}", celsius * 18 / 10 + 32);
    }
}

Sample Output:

Enter the amount of celsius: 40                                                                               
Kelvin = 313                                                                                                  
Fahrenheit = 104

Flowchart:

Flowchart: C# Sharp Exercises - Program to convert from celsius degrees to Kelvin and Fahrenheit

C# Sharp Code Editor:

Improve this sample solution and post your code through Disqus

Previous: Write a C# program that takes a number as input and then displays a rectangle of 3 columns wide and 5 rows tall using that digit.
Next: Write a C# program remove specified a character from a non-empty string using index of a character

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.