Write a Java program to by considering three positive integer a,b and c and determine

whether they can form three sides of a triangle .if yes determine whether triangle is equilateral, isosceles or scalene. Display the message accordingly.


import java.lang.Math; class Triangle { public static void main(String args[]) { int side1,side2,angle; side1=Integer.parseInt(args[0]); side2=Integer.parseInt(args[1]); angle=Integer.parseInt(args[2]); if((side1>0 && side2>0)&&(angle>0 && angle<=180)) { System.out.println("Valid Triangle"); } else { System.out.println("Not Valid Triangle"); } if(side1==side2 && side2==angle) { System.out.println("Equilateral"); } else { if(side1==side2||side1==angle||side2==angle) { System.out.println("Isosceles"); } else { System.out.println("Scalene"); } } } }

output:
D:\JavaPrograms\CmdPrograms>javac Triangle.java D:\JavaPrograms\CmdPrograms>java Triangle 12 12 30 Valid Triangle Isosceles D:\JavaPrograms\CmdPrograms>java Triangle 12 10 30 Valid Triangle Scalene D:\JavaPrograms\CmdPrograms>java Triangle 20 20 20 Valid Triangle Equilateral