Triangle Type

Lab C Intermediate 20 points

Read three side lengths. Print invalid, equilateral, isosceles or scalene.

Input

Three positive integers.

Output

One word.

Example

Input

3 3 3

Output

equilateral
Sample input available Sample output available
Editor
C

Hints

Any side must be shorter than the sum of the other two.

Solution explanation

Checking validity first means the later branches only see real triangles.

Show solution
#include <stdio.h>

int main() {
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    if (a + b <= c || a + c <= b || b + c <= a) {
        printf("invalid\n");
    } else if (a == b && b == c) {
        printf("equilateral\n");
    } else if (a == b || b == c || a == c) {
        printf("isosceles\n");
    } else {
        printf("scalene\n");
    }
    return 0;
}
Output
Answer
HOME LEARN COMMUNITY DASHBOARD