To check greatest of three numbers in java

CODE :

public class P_03_greatest_3_no_part2 {
public static void main(String[] args) {
int a=1,b=2,c=3;
if (a>b && a>c) {
System.out.println("A is greatest");
}
else if (b>c && b>a) {
System.out.println("B is greatest");
}
else{
System.out.println("C is greatest");
}
}
}

Output :


Comments

Popular posts from this blog

To implement the various components of HTML5 Canvas

Program to illustrate the concept of templates.

Program to illustrate the order of execution of constructors and destructors in inheritance.