Thursday, September 6, 2018

16. WAP to check whether a triangle is valid or not where the 3 angles of the triangle are input through keyboard.

#include<stdio.h>
#include<conio.h>
int main()
{
  int a,b,c,sum;
   printf("Enter the angles of the triangle: ");
   scanf("%d%d%d",&a,&b,&c);
   sum=a+b+c;
  if(sum==180 && a!=0 && b!=0 && c!=0)
      printf("It is a valid triangle.",a);
   else
      printf("It is an invalid triangle.",b);
  getch();

}


Output:


Please have a look at the below lesson posted on my YouTube channel:


No comments:

Post a Comment