Program to enter an integer and find out if it is even or odd 1 Attachment(s) Program to enter an integer and find out if it is even or odd #include #include void main() { clrscr(); int x; cout << "Enter an integer : "; cin>>x; if(x%2==0) cout << "The number " << x << " is even."; else cout << "The number " << x << " is odd."; getch(); } It then determines whether the integer is odd or even and outputs the appropriate message using the 'cout' command. Sample Input86 Sample Output The number 86 is even. |
All times are GMT +5. The time now is 07:52 PM. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.