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
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:
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.
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework