Solution of URI 1035::Selection Test 1
Before seeing the solution make sure that you have tried enough. Don’t copy the whole code, just find out the logic. If you feel any problem, you will inform me by comment.
#include<stdio.h>
int main()
{
int A,B,C,D;
scanf("%d%d%d%d",&A,&B,&C,&D);
if (B>C && D>A) {
if ( (C+D)>(A+B)) {
if (C>0 && D>0 && (A%2==0)) {
printf("Valores aceitos\n");
}
else {
printf("Valores nao aceitos\n");
}
}
else {
printf("Valores nao aceitos\n");
}
}
else {
printf("Valores nao aceitos\n");
}
return 0;
}
No comments