+ 1

Whats wrong with this code? C#

I made a three number comparison program using C# using if-else if nested statements to practice nested statements. But when Z is the greatest number it doesn't seem to output that Here is the code on 'Code Playground'. https://code.sololearn.com/cyTpF4qarW1Q/#cs Can you tell me whats wrong with this code?

29th Mar 2017, 5:27 PM
Tariq S
Tariq S - avatar
3 odpowiedzi
+ 24
Or this way Lines 52-63 else if (x > y && x > z) { Console.WriteLine("X is greater than Y and Z"); } else if (y > x && y > z) { Console.WriteLine("Y is greater than X and Z"); } else if (z > x && z > y) { Console.WriteLine("Z is greater than X and Y"); }
29th Mar 2017, 6:24 PM
Illusive Man
Illusive Man - avatar
+ 17
From line 60: else if (y > x) { if (y > z) { Console.WriteLine("Y is greater than X and Z"); } else { Console.WriteLine("z > y > x"); // Add this } }
29th Mar 2017, 5:41 PM
Jafca
Jafca - avatar
+ 17
Also you've got more conditions to add similar to the one you missed already
29th Mar 2017, 5:43 PM
Jafca
Jafca - avatar