Conversion Learn programming with C# Sharp exercises

Lesson:

First contact with C# Sharp


Exercise:

Conversion 63


Objetive:

Create a C# program to convert from Celsius degrees to Kelvin and Fahrenheit: it will ask the user for the amount of Celsius degrees and using the following conversion tables:

Kelvin = Celsius + 273
Fahrenheit = Celsius x 18 / 10 + 32


Code:

using System;
public class exercise14
{
    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);
    }
}