Topic: Function
Write a function-‐oriented program to convert an input Celsius into Fahrenheit degree. Use the formula F= (9.0/5.0)*C+32. Display the Fahrenheit degree.
Note: you can choose any looping statement if needed.
using System;
using System.Collections.Generic;
using System.Globalization;
namespace App
{
class Program
{
static double convertCelsiusIntoFahrenheitDegree(double celsius)
{
return (9.0 / 5.0) * celsius + 32;
}
static void Main(string[] args)
{
Console.Write("Enter Celsius degree: ");
double celsius = double.Parse(Console.ReadLine());
Console.WriteLine("The Fahrenheit degree: {0}", convertCelsiusIntoFahrenheitDegree(celsius));
Console.ReadLine();
}
}
}
Comments
Leave a comment