sahajjain01

Add 2 numbers and tell if it's odd/even.

Aug 4th, 2013
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. //Program to add 2 numbers and tell if it's odd/even.
  2. #include<iostream.h>
  3. #include<conio.h>
  4. void main()
  5. {
  6.     clrscr();
  7.     int a,b;
  8.     cout<<"Enter first number: ";
  9.     cin>>a;
  10.     cout<<"Enter second number: ";
  11.     cin>>b;
  12.     a=a+b;
  13.     cout<<"The sum is: "<<a<<endl;
  14.     if(a%2==0)
  15.     cout<<"The sum is even";
  16.     else
  17.     cout<<"The sum is odd";
  18.     getch();
  19. }
Advertisement
Add Comment
Please, Sign In to add comment