move to repo.or.cz
[letusc.git] / ch2 / exercises2 / ex6.c
blob25a432ded5abb30a3e83a5dda0d56c3f3d508d9f
1 /*check for isoceles,equilateral,right triangle*/
3 #include<stdio.h>
4 #include<math.h>
6 int main()
8 float s1,s2,s3;
9 float temp1,temp2,temp3;
10 printf("Enter the three sides of triangle: ");
11 scanf("%f %f %f",&s1,&s2,&s3);
14 /*checking equality*/
15 if(s1==s2 && s2==s3)
16 printf("This is an equilateral triangle.\n");
17 else if(s1==s2 || s2==s3 || s3==s1)
18 printf("This is an isoceles triangle.\n");
19 else
20 printf("This is a scalene triangle\n");
23 temp1 = sqrt(pow(s2,2)+pow(s3,2));
24 temp2 = sqrt(pow(s1,2)+pow(s3,2));
25 temp3 = sqrt(pow(s2,2)+pow(s1,2));
26 if(s1==temp1 || s2==temp2 || s3==temp3)
27 printf("It is an right triangle\n");
29 return 0;