Nptel 2020: Programming in java Week 1:Q2 Answer

Complete the code segment to find the largest among three numbers x,y, and z. You should use if-then-else construct in Java.

if(x >= y && x >= z)
{
result=x;
}
else if(y >= z)
{
result=y;
}
else
{
  result=z;
  }
System.out.println(result);

Leave a Reply

Your email address will not be published. Required fields are marked *