Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialKeanu Barnard
2,018 PointsSomeone Please Help awnser these Questions
I don't understand how to awnser this task , i don't understand how to applyy a 21-22 range method thing , could someone please give me the awnser or some help, or both would be great thanks !!!
string input = Console.ReadLine();
int temperature = int.Parse(input);
if(temperature < 21)
{
Console.WriteLine("Too cold!");
}
else if (temperature == 21) // I need help here im pretty sure
{
Console.WriteLine("Just right");
}
else if (temperature > 22 );
{
Console.WriteLine("Too hot!");
}
2 Answers
anil rahman
7,786 Pointsstring input = Console.ReadLine();
int temperature = int.Parse(input);
if (temperature < 21)
{
Console.WriteLine("Too cold!");
}
else if (temperature > 22) //this line i changed
{
Console.WriteLine("Too hot!");
}
else
{
Console.WriteLine("Just right.");
}
Mikkel Rasmussen
31,772 Pointsstring input = Console.ReadLine();
int temperature = int.Parse(input);
if(temperature < 21)
{
Console.WriteLine("Too cold!");
}
else if (temperature <= 22) // Changed this line to say if temperature is lower or equeal to 22
{
Console.WriteLine("Just right."); // Added a dot to the sentence
}
else if (temperature > 22 ) // removed this symbol ; cant remember what it is called :P
{
Console.WriteLine("Too hot!");
}
Keanu Barnard
2,018 PointsThanks man Really appreciate the time you took to do this , it helps a lot and is going straight in now so i can keep progressing
anil rahman
7,786 PointsI think it would have been better to use the full if, else if and else syntax. I put the code as an answer.