To add to what Greg has said, you can simplify your code pretty easily.
You code is trying to print one message if z is not the smallest, and another if it is: so make the code reflect that: if it passes one test it can't pass the second because a number can't be both the smallest and not the smallest. Additionally, your code doesn't do anything at all if two number are equal and the smallest.
So try using an
else
clause:
if ((z < x) && (z < y))
{
Console.WriteLine("The third number is the smallest of the three");
}
else
{
Console.WriteLine("The third number is not the smallest of the three");
}
It's also a good idea not to use Convert methods on user input - everybody makes mistakes and using Convert will cause your app to crash if the use miskeys. Instead, use
double.TryParse
and report an error instead:
bool valid;
double x;
do
{
Console.Write("Enter first number: ");
string input = Console.ReadLine();
valid = double.TryParse(input, out x);
if (!valid)
{
Console.WriteLine($"\"{input}\" is not a number! Please try again.");
} while !valid);
It's not a massive problem with only three numbers to input, but when you get to number 20 of 21 and the app crashes because you the wrong key, the user is going to be rather pissed off...