Q:

Write a program named FahrenheitToCelsius that accepts a temperature in Fahrenheit from a user and converts it to Celsius by subtracting 32 from the Fahrenheit value and multiplying the result by 5/9. Display both values to one decimal place

0

Write a program named FahrenheitToCelsius that accepts a temperature in Fahrenheit from a user and converts it to Celsius by subtracting 32 from the Fahrenheit value and multiplying the result by 5/9. Display both values to one decimal place.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;

namespace FahrenheitToCelsius
{
    class FahrenheitToCelsius
    {
        static void Main(string[] args)
        {
            WriteLine("FahrenheitToCelsius");

            double inputTemp = 0;
            double calculatedTemp = 0;

            Write("Temp (in F):");
            inputTemp = double.Parse(ReadLine());
            calculatedTemp = (inputTemp - 32) * (5.0 / 9.0);

            WriteLine("{0} Fahrenheit = {1} Celsius",inputTemp.ToString("#0.0"),calculatedTemp.ToString("#0.0"));

            WriteLine("--End--");
        }
    }
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now