-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtype_triangle.c
44 lines (41 loc) · 914 Bytes
/
type_triangle.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//some problem is there, always showing isosceles triangle
#include<stdio.h>
int main(){
int a,b,c;
printf("Enter values of sides of triangle\n");
scanf("%d%d%d",&a,&b,&c);
//for isosceles triangle
if((a==b)||(b==c)||(a==c)){
printf("Isosceles triangle\n");
}
//for equilateral triangle
else if((a==b)&&(b==c)&&(c==a)){
printf("Equilateral and isosceles triangle\n");
}
//for scalene triangle
else if((a!=b)&&(b!=c)&&(c!=a)){
printf("Scalene triangle\n");
}
//for right angled triangle
else if((b>a)&&(b>c)){
if((b*b)==((a*a)+(c*c))){
printf("Right Triangle\n");
}
else
printf("Not a right triangle\n");
}
else if((a>b)&&(a>c)){
if((a*a)==((b*b)+(c*c))){
printf("Right Triangle\n");
}
else
printf("Not a right triangle\n");
}
else if((c>a)&&(c>b)){
if((c*c)==((a*a)+(b*b))){
printf("Right Triangle\n");
}
else
printf("Not a right triangle\n");
}
}