Bismillahir Rahmanir Rahim
How can you check the number is Negative, Positive, Odd or Even.
Now I'm writing a program for number checking.If you don't understand, comment below.I always ready to solve your problem if it's possible by me.
negative, Positive:
#include<iostream.h>
void main()
{
int n;
cout<<"Enter your number: ";
cin>>n;
if(n>0)
cout <<n<<" is positive.";
else if(n<0)
cout <<n<<" is negative.";
else
cout <<n<<" is 0.";
}
void main()
{
int n;
cout<<"Enter your number: ";
cin>>n;
if(n>0)
cout <<n<<" is positive.";
else if(n<0)
cout <<n<<" is negative.";
else
cout <<n<<" is 0.";
}
Odd or Even:
#include<iostream.h>
void main()
{
int n;
cout<<"Enter your number: ";
cin>>n;
if(n%2==0)
cout <<n<<" is Even.";
else
cout <<n<<" is Odd.";
}
#include<iostream.h>
void main()
{
int n;
cout<<"Enter your number: ";
cin>>n;
if(n%2==0)
cout <<n<<" is Even.";
else
cout <<n<<" is Odd.";
}