Answer the question
In order to leave comments, you need to log in
Produces incorrect result. Where is the mistake?
Explain to the blind man why the program below displays either "C" or nothing, empty, emptiness, 0.
The task is this:
And here is the code itself:
int main()
{
float x, y, r1, r2, t;
printf("r1 = ");
scanf("%d", &r1);
printf("r2 = ");
scanf("%d", &r2);
printf("x = ");
scanf("%d", &x);
printf("y = ");
scanf("%d", &y);
t = (x * x)+ (y * y);
if (t > r2*r2) printf("D");
else if (t > r1*r1)
{
if (x > 0 && y > 0) printf("D");
else printf("B");
}
else if (t < r1*r1)
{
if (x > 0 && y > 0) printf("C");
else printf("A");
}
return 0;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question