C++ Program To Find ODD (or) Even
This program is to find ODD and EVEN between two numbers.
Algorithm:
1.Start
2.Get the input from user for variable a (ie) one integer numbers
3.Compare whether a% 2 is equal to zero
4.If step-3 is true then print a "Is Even" else Print a "Is Odd"
5.Stop
Program:
# include <iostream.h>
# include <conio.h>
void main ()
{
clrscr();
int a;
cout << "Enter Value Of A:";
cin >> a;
if (a% 2 == 0)
{
cout << a << "Is EVEN";
}
else
{
cout << a << "Is ODD";
}
getch ();
}
Algorithm:
1.Start
2.Get the input from user for variable a (ie) one integer numbers
3.Compare whether a% 2 is equal to zero
4.If step-3 is true then print a "Is Even" else Print a "Is Odd"
5.Stop
Program:
# include <iostream.h>
# include <conio.h>
void main ()
{
clrscr();
int a;
cout << "Enter Value Of A:";
cin >> a;
if (a% 2 == 0)
{
cout << a << "Is EVEN";
}
else
{
cout << a << "Is ODD";
}
getch ();
}
No comments