Problem Description: Accept the temperature from the user. If the temperature is
greater than or equal to 32, display a message "The climate is good today" and check
whether the temperature is exactly equal to 32. If it is exactly equal to 32, display a
message "The temperature is 32". If the temperature is greater than 32, then display
a message "It is hot today"
VulpesPosted Nov 16, 2011, 6:29 PM
Vipul KelkarPosted Nov 16, 2011, 9:35 PM
In the statement
double temperature = double.parse(Console.ReadLine());
DOUBLE is the data type of the variable "temperature" as temperature can be a decimal value like 32.5, 19.1 etc. This is where we have declared our variable.
We have accepted the value from the user which is 'Console.ReadLine()' part.
This returns the user input as a string. To store it in a variable of type double, we have converted the string using double.parse()
Mike PatelPosted Nov 16, 2011, 7:52 PM
double temperature = double.parse(Console.ReadLine());