If remainder is 0 then, that number is even otherwise that number is odd. This task is performed using if...else statement in C programming and the result is displayed accordingly.

Source Code:-
#include<iostream.h>
#include<conio.h>
void main()
{clrscr();
int a;
cout<<"Check Number is Even or Odd by-Tarun Rawar\n";
cout<<"\nEnter number to check : ";
cin>>a;
if(a%2==0)
cout<<"\n"<<a<<" is a Even number ";
else cout<<"\n"<<a<<" is a Odd number ";
getch();
}
No comments:
Post a Comment