Which type of selection control structure can be used to display the largest of three numbers and write the syntax of it.
Answers
Answered by
0
Answer:
ElseIf statement
Syntax:
If(condition)
{//stmts
}
elseif(condition)
{
//Stmts
}
else{
//stmts
}
Ex:
class big{
public static void main(String args[]){
int a=40, b=78, c=19;
if(a>=b && a>=c)
System.out.println(a+" is the largest Number");
else if (b>=a && b>=c)
System.out.println(b+" is the largest Number");
else
//print c
System.out.println(c+" is the largest number");
}
}
Similar questions