Use if statement to find the greatest of three numbers stored in the cell?
Answers
Answered by
0
We can assume the use of dummy variables in the solution.
Let the three numbers be a,b and c
The programming language used in the following snippet is JAVA
if (a>b && a>c)
max= a; // If the first condition is true then the first number is the greatest
else if (b>a && b>c)
max= b; // If the second condition is true then the second number is the greatest
else
max=c; // If both the conditions are false then the third number is the greatest
Let the three numbers be a,b and c
The programming language used in the following snippet is JAVA
if (a>b && a>c)
max= a; // If the first condition is true then the first number is the greatest
else if (b>a && b>c)
max= b; // If the second condition is true then the second number is the greatest
else
max=c; // If both the conditions are false then the third number is the greatest
Similar questions