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
#include <stdio.h>
int main()
{
int x, y;
printf("Input two integers: ");
if(scanf("%d %d", &x, &y) != 2)
{
printf("Bad input\n");
return 1;
}
if(x < 2000 || 3000 < x)
{
printf("x = %d\n", x);
}
if(100 < y && y < 500)
{
printf("y = %d\n", y);
}
return 0;
}
Comments
Leave a comment