Basic

Switch Case

Goto

Operators

if Statement

Nested if

While Loop

For Loop

Array

Patterns

Excersises


Check whether Triangle is Valid or Not using Sides


The following table shows, how to Check whether Triangle is Valid or Invalid using Sides in C Program.

Example Program : pgm.c

#include<stdio.h>
int main()
{
    int s1,s2,s3;
    printf("\nEnter Three Sides : ");
    scanf("%d%d%d",&s1,&s2,&s3);
    if((s1+s2)>s3 && (s2+s3)>s1 && (s1+s3)>s2){
        printf("\nValid Triangle");
    }else{
        printf("\nInvalid Triangle");
    }
    return 0;
}

Output:

Enter Three Sides :
  7
  10
  5
Valid Triangle