Finding largest number among three using Java in NetBeans
public class p06_largestamongthree {
public static void main(String[] args) {
int a=8, b= 7, c=6;
if(a>b && a>c)
{
System.out.println("Largest number among three is "+a);
}
else if(b>a && b>c)
{
System.out.println("Largest number among three is "+b);
}
else
{
System.out.println("Largest number among three is "+c);
}
}
}
public static void main(String[] args) {
int a=8, b= 7, c=6;
if(a>b && a>c)
{
System.out.println("Largest number among three is "+a);
}
else if(b>a && b>c)
{
System.out.println("Largest number among three is "+b);
}
else
{
System.out.println("Largest number among three is "+c);
}
}
}