WAP to input the length of three sides of a triangle. If all the sides
are equal print “triangle is equilateral”; if any two sides are equal,
print “the triangle is isosceles”; and if none of the sides are equal
print “the triangle is neither equilateral nor isosceles”. Use If-
Then-Else statement. IT IS FROM COMPUTER.
Answers
Answered by
0
Answer:
Explanation:
// C# program for the above approach
using System;
class GFG{
// Function to check if the triangle
// is equilateral or isosceles or scalene
static void checkTriangle(int x, int y, int z)
{
// Check for equilateral triangle
if (x == y && y == z )
Console.WriteLine("Equilateral Triangle");
// Check for isoceles triangle
else if (x == y || y == z || z == x )
Console.WriteLine("Isoceles Triangle");
// Otherwise scalene triangle
else
Console.WriteLine("Scalene Triangle");
}
// Driver Code
public static void Main()
{
// Given sides of triangle
int x = 8, y = 7, z = 9;
// Function call
checkTriangle(x, y, z);
}
}
// This code is contributed by code_hunt
Similar questions