0
Largest numvber of three numer using nested if else
2 Answers
+ 2
What have you tried so far? Which part of this task is giving you trouble?
You would have the three numbers in variables such as a, b, c
Make a 4th variable to store the max
You can write comparisons in "if" statements, and compare two variables at a time. When you figure which of the two is bigger, compare it to the third one. Then assign the result to your max variable.
0
Can you explain what you are having troubles with? I think a nested if/else is not needed. You could define a max function which takes in two integers and returns the larger of the two. You can daisy chain calls to your max function then to find the largest of three:
max(x, max(y, z));