Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int trianglecheck(float a, float b, float c)
- {
- if ((a<(b+c))&&(b<(a+c))&&(c<a+b)&&(a>(abs(b-c)))&&(b>(abs(a-c)))&&(c>(abs(a-b))))
- {
- return 0;
- }
- else return 1;
- }
- int main()
- {
- float a,b,c;
- int test;
- printf("Entre com os tres lados da figura : \n"); scanf("%f %f %f",&a,&b,&c);
- test = trianglecheck(a,b,c);
- if (test == 1)
- {
- printf("Figura nao constitui triangulo!\n");
- }
- else
- {
- if ((a==b)&&(a==c)) printf("Triangulo equilatero!\n");
- else if ((a==b)||(a==c)||(b==c)) printf("Triangulo isosceles!\n");
- else printf("Triangulo escaleno!\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment