Check Even or Odd in C++

This program checks if a given number is even or odd.

#include <iostream>

int main() {

    int number;

    std::cout << "Enter a number: ";

    std::cin >> number;

    if (number % 2 == 0) {

        std::cout << number << " is even." << std::endl;

    } else {

        std::cout << number << " is odd." << std::endl;

    }

    return 0;

}


No comments:

Post a Comment

MS Excel Logical Functions

Logical functions in Excel are powerful tools that help you make decisions based on conditions. Whether you're comparing values or testi...

Post Count

Loading...