Write a program to find given number is even or odd using C program-computer 11 neb- C program-GRADE 11




Write a program to find given number is even or odd using C program .


#include <stdio.h>

int main() {
    int number;

    // Input: Ask user for a number
    printf("Enter an integer: ");
    scanf("%d", &number);

    // Condition: Check if number is even or odd
    if (number % 2 == 0) {
        printf("%d is even.\n", number);
    } else {
        printf("%d is odd.\n", number);
    }

    return 0;
}

Post a Comment

0 Comments