# C++ Program To Check Even Or Odd Using Pointer

Problem:- Write A Program To Find A Number Is Even Or Odd Using a Pointer or a c++ program to find even and odd numbers using the function or a c++ program to find odd or even using a class or a c++ program to find even and odd numbers using an array or c program to print even numbers in an array or even odd program in c++ using an array or c++ odd or even loop or c++ program to check whether a number is even or odd using a function or c program to check whether a number is prime or not using the function or c program for even or odd using for loop

Logic:- As we know that if the number is less than zero then a number is Negative or if a Number is Greater than Zero then the number is Positive or in any case number is equal to zero. So in this problem we are comparing if the entered number by the user is less than zero or greater than zero or if both conditions fail then a number is definitely zero or we can say entered a number is zero.

Extreme Recommended:- If you have any queries you can ask there with lots of coders also suggest to your Friends to join and like our page, so we can help our community, and don't forget to Subscribe. Enter your Email and click to subscribe.

Solution:-

#include<iostream>
using namespace std;
int main()
{
int a;
int *p1;

p1=&a;

cout<<"Enter The Number You Want to Check \n\n";
cin>>a;

if(*p1>0)
{
cout<<"Number Is Possitive \n";
}
else if(*p1<0)
{
cout<<"Number Is Negative \n";
}
else
{
cout<<"Number Is Equal to Zero\n\n";
}
return 0;

}

Output:-

### You May Also Like

Previous Post
Next Post

#### post written by: Ghanendra Yadav

Hi, I’m Ghanendra Yadav, SEO Expert, Professional Blogger, Programmer, and UI Developer. Get a Solution of More Than 500+ Programming Problems, and Practice All Programs in C, C++, and Java Languages. Get a Competitive Website Solution also Ie. Hackerrank Solutions and Geeksforgeeks Solutions. If You Are Interested to Learn a C Programming Language and You Don't Have Experience in Any Programming, You Should Start with a C Programming Language, Read: List of Format Specifiers in C.