Mohammad Abd El-Fattah Mohammad
Cybersecurity & AI Engineer
Open to opportunities

Programming

Odd Even Positve Nagtive

Reads a number and prints whether it is positive or negative and even or odd.

By Mohammad Abd El-Fattah Mohammad · 1 min read

Source Code

#include <iostream>
using namespace std;
int main(){
	int x;
	cout << "Enter Any Number \n";
	cin >> x;
	if      ((x >= 0) && (x % 2==0))
		cout << "Number Is Postive Even \n";
	else if ((x <= 0) && (x % 2 !=0))
		cout << "Number Is Nagtive Even \n";
	else if ((x >= 0) && (x % 2 !=0))
		cout << "Number Is Postive Odd  \n";
	else if ((x <= 0) && (x % 2 !=0))
		cout << "Number Is Nagtive Odd  \n";
	else
		cout << "Enter Vaild Number \n";
    return 0;}

Source file in my repo: Basics/Odd_Even_Positve_Nagtive