Input Centigrade and output Fahrenheit.
★☆☆Fahrenheit was once the main scale used in England and is still widely used in America, although the founding fathers thought about adopting the metric system instead. Around 1965, Britain began switching towards the metric system.
Write a program that converts between Centigrade and Fahrenheit.
Remember to add a comment before a subprogram to explain its purpose.
c_to_f so that:Main should print the prompt and read the Centigrade value as an integer.c_to_f subprogram.Enter the temperature in Centigrade:
30
30 degrees Centigrade is 86.0 degrees Fahrenheit.
// Temperature converter program
using System;
class Submission
{
---
// -------------------------
// Subprograms
// -------------------------
// Convert Centigrade to Fahrenheit
---
static double c_to_f(int centigrade)
{
---
return (centigrade * 1.8) + 32;
---
}
---
// -------------------------
// Main program
// -------------------------
public static void Main(string[] args)
{
---
Console.WriteLine("Enter the temperature in Centigrade:");
int centigrade = Convert.ToInt32(Console.ReadLine());
---
double fahrenheit = c_to_f(centigrade);
---
Console.WriteLine(centigrade + " degrees Centigrade is " + fahrenheit + " degrees Fahrenheit.");
---
}
---
}