//Write a program to check whether a number is even or odd.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int n;
cout<<"Check a Number Even or Odd";
cout<<"\n\nEnter a number-";
cin>>n;
if(n%2==0)
cout<<"Enter number is even";
else
cout<<"Enter number is odd";
cout<<"\n\nPress Key For exit.....";
getch();
}
Output:
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int n;
cout<<"Check a Number Even or Odd";
cout<<"\n\nEnter a number-";
cin>>n;
if(n%2==0)
cout<<"Enter number is even";
else
cout<<"Enter number is odd";
cout<<"\n\nPress Key For exit.....";
getch();
}
Output:
No comments:
Post a Comment