Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- int main (){
- int A, B, C, D;
- char res;
- printf("Insira quantro numeros entre 1 e 100 separados por espaco: \t");
- scanf("%i %i %i %i", &A,&B,&C,&D);
- if ( (A<1) || (A>100) || (B<1) || (B>100) || (C<1) || (C>100) || (D<1) || (D>100) ){
- printf("\n\n\tVALORES N COMPREENDIDOES ENTRE 1 E 100\n\n");
- } else {
- //A+B+C;
- if (((abs(B-C))<A && A<(B+C)) || ((abs(A-C))<B && B<(A+C)) || ((abs(A-B))<C && C<(A+B))){
- res='S';
- }
- //A+C+D;
- else if (((abs(C-D))<A && A<(C+D)) || ((abs(A-D))<C && C<(A+D)) || ((abs(A-C))<D && D<(A+C))){
- res='S';
- }
- //A+B+D;
- else if (((abs(B-D))<A && A<(B+D)) || ((abs(A-D))<B && B<(A+D)) || ((abs(A-B))<D && D<(A+B))){
- res='S';
- }
- //B+C+D;
- else if (((abs(C-D))<B && B<(C+D)) || ((abs(B-D))<C && C<(B+D)) || ((abs(B-C))<D && D<(B+C))){
- res='S';
- } else {
- res='N';
- }
- printf("\n\n\t %c \n\n",res);
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment