# TEMA

wrong 100%,not printing a particular section

#### Rafid Al Nahiyan preguntado 3 years ago

pleasw help.in my code "odd negative" number isn't showing any output.what's the problem in my code? please use english language.

include

int main() { int n, x, i; scanf("%d", &n);

``````for (i = 1; i <= n; i++)
{
scanf("%d", &x);

if (x % 2 == 1 && x < 0)
{
printf("ODD NEGATIVE\n");
}

else if (x % 2 == 1 && x > 0)
{
printf("ODD POSITIVE\n");
}

else if (x % 2 == 0 && x < 0)
{
printf("EVEN NEGATIVE\n");
}

else if (x % 2 == 0 && x > 0)
{
printf("EVEN POSITIVE\n");
}

else if (x == 0)
{
printf("NULL\n");
}
}
return 0;``````

}

Recuerda no enviar soluciones. Tu mensaje puede ser revisado por nuestros moderadores.

• #### Micael respondido 2 years ago

``````#include <stdio.h>
int main() {
int n, x, i;
scanf("%d", &n);
for (i = 1; i <= n; i++)
{
scanf("%d", &x);
if (x % 2 != 0 && x < 0)
{
printf("ODD NEGATIVE\n");
}
else if (x % 2 != 0 && x > 0)
{
printf("ODD POSITIVE\n");
}
else if (x % 2 == 0 && x < 0)
{
printf("EVEN NEGATIVE\n");

}
else if (x % 2 == 0 && x > 0)
{
printf("EVEN POSITIVE\n");
}
else if (x == 0)
{
printf("NULL\n");
}

} return 0;
}``````

I did it. I just switched the if condition of if (x % 2 == 1 && x < 0) to if (x % 2 != 0 && x < 0)