Write a program to find maximum of three numbers in Java1 min read
Here is my solution to Write a program to find maximum of three numbers in Java
class Max { public static void main(String arg[]) { int a,b,c; a=Integer.parseInt(arg[0]); b=Integer.parseInt(arg[1]); c=Integer.parseInt(arg[2]); if(a>=b) { if(a>=c) System.out.println(a+" is greater "); else System.out.println(c+" is greater "); } else { if(b>=c) System.out.println(b+" is greater "); else System.out.println(c+" is greater "); } } }
Output:
Vishal Sharma Answered question