Before seeing the solution make sure that you tried enough. Don’t paste the whole code, just find out the logic. If you stuck in trouble, just inform me on comment.
/**Bismillahir Rahmanir Rahim.**/
#include <stdio.h>
int main()
{
int A, B, C, D;
scanf ("%d%d%d%d", &A,&B,&C,&D);
if(B>C && D>A && C+D>A+B && C>=0 && D>=0 && A%2==0)
printf("Valores aceitos\n");
else
printf ("Valores nao aceitos\n");
return 0;
}
i also gave the same logic, but uri showed wrong answer, why??
ReplyDeletewrong answer 20%, for what?
ReplyDelete#include
int main (){
int A, B, C, D;
scanf ("%d %d %d %d",&A, &B, &C, &D);
if( (D-A>B-C) && (C>=0) && (D>=0) && (A%2==0) ){
printf ("Valores aceitos\n");
}else{
printf ("Valores nao aceitos\n");
}
return 0;
}