This program accepts the length of the three sides of triangle. A B and C determines the type of triangle.
# include Void maib() { int a,b,c,x,y,z; int TRIANGLE=0, OBTUSE=0, ACUTE=0,RIGHTANGLE=0,EQLTRI=0,ISOCLS=0; cout<< “Enter three side of a triangle “; cin >>a>>b>>c;
if(a>b&&a>c) { x=a; y=b; z=c; } else if (b>c) { x=b; y=c; z=a; } else { x=c; y=a; z=b; }
TRAIANGLE=XOBTUSE=x*x>y*y+z*z; // A obtuse angled triangle is formed ACUTE= x*xRIGHTANGLE=x*x==y*y+z*z; // A right angle triangle is formed EQLTRI=x = = y && y = =z; // An equilateral triangle is formed ISOCLS=x== y||y= = z|| z = = x; // An Isosceles triangle is formed
If ( TRAINGLE) { cout < “ Triangle is possible”;
If (RIGHTANGLE) cout << “ Right Angle triangle”; else If(OBTUSE) cout << ” Obtuse angle triangle”; else If (ACTUE) { cout <<” Acute angle triangle”; if (EQLTRL) cout < < “ Equilateral triangle”; else if (ISOCLS) cout <<” Isosceles triangle”; else cout << “ Scalene triangle “; } } else cout << “ not a Triangle “; }
|
No feedbacks found. Be the first to respond and make money from revenue sharing program.
|