60 429
Assignments Done
98,1%
Successfully Done
In April 2018

Answer to Question #54474 in C for rajashree g.s

Question #54474
declare two variables x and y.assign values to these variables.Number x should be printed only if it is less than 2000 or greater than 3000 and number y should be printed only if it is between 100 and 500. please explain the logic sir.
Expert's answer
Solution
int main()
{
int x, y; // You declare variables x and y
scanf_s("%d", &x); // You assign value for x
scanf_s("\n%d", &y); // You assign value for y

if (x < 2000 || x > 3000) {
// Number x should be printed only if it is less than 2000 or greater than 3000
printf("\n%d", x); // You print variable x
}

if (y > 100 && y < 500) {
// Number y should be printed only if it is between 100 and 500 (variable y must be greater
// than 100 and less than 500)
printf("\n%d", y); // You print variable x
}

return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions