Check Whether an number is even or odd


SUBMITTED BY: Guest

DATE: Oct. 26, 2014, 12:11 p.m.

FORMAT: C++

SIZE: 308 Bytes

HITS: 768

  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int num, con;
  6. clrscr();
  7. cout<<"Input any integer ";
  8. cin>>num;
  9. dir=num;
  10. con=num%2;
  11. if (con==0)
  12. {
  13. cout<<"\nInteger is Even";
  14. getch();
  15. }
  16. else
  17. {
  18. cout<<"\nInteger is odd";
  19. return 0;
  20. }

comments powered by Disqus