Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int trngl(int x, int y, int z)
- {
- if(x + y > z && y + z > x && z + x > y) return 1;
- else return 0;
- }
- int sgmnt(int x, int y, int z)
- {
- if(x + y == z || y + z == x || z + x == y) return 1;
- else return 0;
- }
- int main()
- {
- int a[4], i, j, k;
- for(i = 0; i < 4; i++) scanf("%d", &a[i]);
- int f_tr = 0, f_sg = 0;
- for(i = 0; i < 4; i++)
- {
- for(j = i + 1; j < 4; j++)
- {
- for(k = j + 1; k < 4; k++)
- {
- f_tr = f_tr || trngl(a[i], a[j], a[k]);
- if(f_tr == 1)
- {
- printf("TRIANGLE\n");
- return 0;
- }
- f_sg = f_sg || sgmnt(a[i], a[j], a[k]);
- }
- }
- }
- if(f_sg == 1) printf("SEGMENT\n");
- else printf("IMPOSSIBLE\n");
- }
Advertisement
Add Comment
Please, Sign In to add comment