to find biggest number among three numbers using binary operator

+1 vote
asked Aug 5 by anonymous

1 Answer

0 votes
answered Aug 6 by (140 points)

import java.util.Scanner;

class Biggest{

public static void main(String[] args)

{

int a,b,c;

Scanner sc = new Scanner(System.in);

a = sc.nextInt();

b=sc.nextInt();

c=sc.nextInt();

if(a>b)

{

if(a>c)

{

System.out.println(a+" is the biggest number of the three numbers"+a+","+b+" and "+c);

}

else if(a==c)

{

System.out.println(a+" is equal to "+c+" and greater than "+b);

}

else{

System.out.println(c + " is the biggest number of the three numbers "+a+","+b+" and "+c);

}

}

else{

if(b>c)

{

System.out.println(b+"is greatest of the three numbers"+a+","+b+" and "+c);

}

else if(b==c){

System.out.println(b+ " is equal to "+c +" and greater than "+a);

}

else{

System.out.println(c+"is greatest of the three numbers"+a+","+b+" and "+c);

}

}

}

}

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...