Q:

Write C program to check whether the triangle is equilateral

belongs to collection: C Programming Examples

0

Before writing the C program to check whether the triangle is equilateral, we should know the properties of equilateral triangles. In geometry, an equilateral triangle is a triangle in which all three sides are equal.

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) && (side2==side3))
    {
        //All sides are equal, so Equilateral triangle
        printf("Equilateral triangle.\n\n");
    }
    else
    {
        printf("Not a Equilateral triangle.\n\n");
    }
    return 0;
}

Output:

Enter sides of triangle

3

3

3

Equilateral 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 isoscel... >>
<< Find the largest of two given number using ternary...