[Solved] So,I made this simple C program to give output,so it is correct for positive and zero integer values but it is coming wrong for negative even and odd


Just reindent your code you will find strange { like the one after printf("Positive");

Juste removing this strange { and fixing your coding style will be:

#include<stdio.h>
int main() {
    int x;
    scanf("%d", &x);

    if ( x > 0 ) {
        printf("Positive");
        if ( x % 2 == 0 ) {
            printf("Even");
            
        } else {
            printf("Odd");
        }
    } else if( x < 0 ) {
        printf("Negative");
        if( x % 2 == 0 ) {
            printf("Even");
        } else {
            printf("Odd");
        }
    }   
    else {
        printf("Zero");
    }   
    return 0;
} 

easier to read, easier to debug

2

solved So,I made this simple C program to give output,so it is correct for positive and zero integer values but it is coming wrong for negative even and odd