De celsius a fahrenheit

using System; namespace programa { class Calculo { static void Main(string[] args) { Console.WriteLine("Introduce valor:"); double valor = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Introduciste: {0}",valor); Console.WriteLine("1. Celsius\n2. Fahrenheit\nOpcion:"); int opcion = Int32.Parse(Console.ReadLine()) ; switch(opcion) { case 1: Console.WriteLine("Celsius: {0}",getCelsius(valor)); break; case 2: Console.WriteLine("Fahrenheit: {0}",getFahrenheit(valor)); break; default: break; } } static double getCelsius(double valor) { return (valor -32) * 0.555; } static double getFahrenheit(double valor) { return (valor * 1.8) + 32; } } }
Sencillo programa en C#

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.