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.
#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: