Sample Program:-
public class LargestNumber {
public static void main(String[] args) {
int a, b, c;
a = 20;
b = 30;
c = 40;
if (a > b && a > c)
System.out.println("a is largest");
else if (a < b && b > c)
System.out.println("b is largest");
else if (a < c && b < c)
System.out.println("c is largest");
else
System.out.println("a, b, c are not different");
}
}
Output:-
c is largest
Enjoy Coding.
No comments:
Post a Comment