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 create an html page with frames and frameset

1. Write a program to insert a new element at end as well as at a given position in an array in Java

1. To familiarize with network devices like switch, hub, routers and bridges in LaTex