# Thread: Find odd and even number in c++

1. Senior Member+
Last Online
2nd May 2013 @ 12:28 PM
Join Date
01 Feb 2013
Location
Karachi
Gender
Male
Posts
223
3
Credits
0
Thanked
5

## Find odd and even number in c++

#include<iostream>
using namespace std;
void main()
{
int cont,a;
cout<<"Enter a number\t";
cin>>a;
if (a%2==0 &&a>0)
cout<<"Even\n";
else
cout<<"Odd\n";
}

Learn C++ Tutorial.
مطالعہ سب کے لئے

2. Junior Member
Last Online
29th November 2013 @ 10:54 AM
Join Date
29 Mar 2013
Location
Lahore
Age
27
Gender
Male
Posts
25
3
Credits
702
Thanked: 1
Very GOOD

3. Senior Member+
Last Online
19th February 2020 @ 03:18 PM
Join Date
28 Feb 2009
Posts
203
6
Credits
498
Thanked
12
very nice .... Prime numbers ka lya kia programme ho ga

4. great work

5. Senior Member+
Last Online
2nd May 2013 @ 12:28 PM
Join Date
01 Feb 2013
Location
Karachi
Gender
Male
Posts
223
3
Credits
0
Thanked
5
Thank you buddy

6. Senior Member+
Last Online
5th May 2013 @ 06:20 PM
Join Date
01 May 2013
Gender
Male
Posts
32
1
Credits
0
Thanked
0
great

7. Junior Member
Last Online
28th October 2013 @ 07:53 PM
Join Date
25 Oct 2013
Age
21
Gender
Male
Posts
3
0
Credits
458
Thanked
0
#include <iostream.h>
#include <conio.h>
#include <math.h>
#include <stdlib.h>
main()

{

int num1,num2,num3,result;
char choice;
do
{
cout <<"Please selecct a number to perform the funtion"<<"\n";
cout<<"2:Subtraction\n";
cout<<"3ivison\n";
cout<<"4:Multiplication\n";
cout<<"5:Squareroot\n";
cout<<"6:Help\n";
cin>>choice;
}
while(choice<'1' || choice>'7' || choice='q')
switch (choice)
{
if (choice==q)
break;
case '1';
cin>>num1;
cin>>num2;
result=num1+num2;
break;
case '2';
cin<<num1;
cout<<"Please enter another num to be Subtracted:\n";
cin>>num2;
result=num1-num2;
break;
case '3';
cin>>num1;
cout<<"Please enter another num to be divided:\n";
cin>>num2;
result=num1/num2;
break;
case '4';
cin>>num1;
cout<<"Please enter another number to be multiplied:\n";
cin>>num2;
result=num1*num2;
break;
case '5';
cin>>num1;
result=sqrt(num1);
break;
case '6';
cout<<"Please select an option to perform the funtion"<<end;<<"e.g Press 1 for Addition e.t.c\n"
break;
case '7';
break;
default;
cout<<"It is not an option\n"
getch();
}
}

\\ye program dev++ mai compile nai ho raha .is program mai errors aa rai hain plz help;
cin

8. Senior Member+
Last Online
7th December 2013 @ 01:55 PM
Join Date
01 Sep 2013
Location
bahawalpur
Age
24
Gender
Male
Posts
32
3
Credits
790
Thanked
0
nice