Write a
program to enter three sides of a triangle
and check wheather the triangle is possible if
possible then display wheather it is eqilateral
an Isoceles or
a scalare triangle, otherwise display
message Triangle is not possible
Answers
Answer:
this will be in java
Explanation:
#include <stdio.h>
int main()
{
int side1, side2, side3;
/* Input sides of a triangle */
printf("Enter three sides of triangle: ");
scanf("%d%d%d", &side1, &side2, &side3);
if(side1==side2 && side2==side3)
{
/* If all sides are equal */
printf("Equilateral triangle.");
}
else if(side1==side2 || side1==side3 || side2==side3)
{
/* If any two sides are equal */
printf("Isosceles triangle.");
}
else
{
/* If none sides are equal */
printf("Scalene triangle.");
}
return 0;
}
PLS GIVE BRAINLIEST
Explanation:
import java.util.*;
public class Solution
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.print("Input side1: ");
int s1 = in .nextInt();
System.out.print("Input side2: ");
int s2 = in .nextInt();
System.out.print("Input side3: ");
int s3 = in .nextInt();
System.out.print("Is the said sides form a triangle: " + isValidTriangle(s1, s2, s3));
}
public static boolean isValidTriangle(int a, int b, int c)
{
return (a + b > c && b + c > a && c + a > b);
}
if(a=b=c)
System.out.println("equilateral");
else if(a=b//a=c//b=c)
System.out.println("isosceles");
}
}