if the three of triangle are entered through the keyboard write a program to check whether the triangle is isosceles equilateral ,scalene or right angle tringle.

 

 

 

 

if the three of triangle are entered through the keyboard write a program to check whether the triangle is isosceles equilateral ,scalene or right angle triangle.

#include<stdio.h>
#include<conio.h>
#include <math.h>
 int main() 
{ 
 int x,y,z; // side of triangle
 int max, flag=0;
printf("Inter the first side:"); 
scanf("%d",&x); 
 printf("Enter the second side"); 
scanf("%d"'&y);
 printf("Enter the third side");
 scanf("%d"'&z); //equilateral means three (all) side are of same length 
 if (x==y&&x==z) 
{ 
printf ("Tringle is equilateral"); 
 } 
//isosceles means two sides are of the length 
else if(x==y||y==z||z=x)
 { 
 printf("Triangle is isosceles"); 
 } //Right angle means it contains a 90 degree angle with pythogors theorem
 //check for maximum side
 max=x; if(y>max) max=y; max=z; if (max==x) //theorem
 { 
if(pow(max,z)=pow(y,2)+z,2))
 flaf=1; 
}
 if(max==y) //theorem
 {
 if(pow(max,z)==pow(x,2)+pow(y,2)) 
 flag=1; if(flag==1) 
{ 
 printf("triangle is right angle");
 }
 }
 }





Comments

Popular posts from this blog

re

. Assign Cookies