w3resource
C# Sharp Programming Exercises

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?



New Content: Composer: Dependency manager for PHP, R Programming