C# SAMPLE CODE: using System; using System.Collections.Generic; using System.Lin
ID: 3725152 • Letter: C
Question
C# SAMPLE CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SimpleTempConversion {
/* Class to convert Celsius temperature to Fahrenheit
* Author ....
* Date: July 2015
*/
class CelsiusToFahrenheit {
public static void Main() {
double celsius = 0.0;
//input the temperature in degrees Celsius
Console.Write("Enter degrees Celsius: ");
celsius = int.Parse(Console.ReadLine());
// Calculate degrees Fahrenheit and output the result
Console.WriteLine(" The equivalent in Fahrenheit is " + celsius/5 * 9 + 32);
Console.WriteLine(" Hit Enter to exit.");
Console.ReadLine();
}
}
}
Explanation / Answer
Hi
I have fixed the issue and highlighted the code changes below
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SimpleTempConversion {
/* Class to convert Celsius temperature to Fahrenheit
* Author ....
* Date: July 2015
*/
class CelsiusToFahrenheit {
public static void Main() {
double celsius = 0.0;
//input the temperature in degrees Celsius
Console.Write("Enter degrees Celsius: ");
celsius = int.Parse(Console.ReadLine());
// Calculate degrees Fahrenheit and output the result
Console.WriteLine(" The equivalent in Fahrenheit is " + (celsius/5 * 9 + 32));
Console.WriteLine(" Hit Enter to exit.");
Console.ReadLine();
}
}
}
Output:
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.