Q:

C program to check whether the triangle is isosceles

belongs to collection: C Programming Examples

0

Before writing the C program to check whether the triangle is isosceles, we should know the properties of equilateral triangles. In geometry, an isosceles triangle is a triangle that has two sides of equal length.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include <stdio.h>
int main()
{
    int side1, side2, side3;
    //Get sides of a triangle from the user
    printf("Enter sides of triangle\n");
    scanf("%d%d%d", &side1,&side2,&side3);
    if((side1==side2) || (side1==side3) || (side2==side3))
    {
        //two sides are equal, so isosceles triangle
        printf("isosceles triangle.\n\n");
    }
    else
    {
        printf("Not a isosceles triangle.\n\n");
    }
    return 0;
}

Output:

Enter sides of triangle

4

6

4

isosceles triangle.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C program to check whether the triangle is valid o... >>
<< Write C program to check whether the triangle is e...