Programming Course in C# ¡Free!

Conversion

 Sunday, March 31, 2013 published by Exercises C#
Proposed exercise

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



Output



Solution


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