Program to check what is the type of triangle using its sides in java.

import java.util.Scanner;

class Triangle {

    public static void main(String[] args) {

        Scanner sc =new Scanner(System.in);

        System.out.print("enter three sides of triangle=");

        int a=sc.nextInt();

        int b=sc.nextInt();

        int c=sc.nextInt();

        if(a==b && b==c)

        System.out.println("equilateral triangle");

        else if(a==b || b==c || c==a)

        System.out.println("isoscalene triangle");

        else

        System.out.println("scalene triangle");

    }

}


■》 Output->

enter three sides of triangle=

3

4

5

scalene triangle 


Comments

Popular posts from this blog

Introduction of java Programming language.

Stack data structure.