Monday 16 June 2014

C++ program to check whether a triangle is valid or not



Here is a C++ program to check whether a triangle is valid or not


 SOURCE CODE OUTPUT
#include<iostream>
using namespace std;
int main()
{
  int a,b,c,d;
  cout<<"Enter the three angles of triangle";
  cin>>a>>b>>c;
  d=a+b+c;
  if(d==180)
     cout<<"Triangle is valid";
  else
     cout<<"Triangle is not valid";
  return 0;
}

Any questions regarding to program please write in comments.

No comments:

Post a Comment