Write a program that takes a number and checks whether the Number is even or odd. Using if-else

Checks whether the Number is even or odd. Using if-else

Write a program that takes a number and checks whether the Number is even or odd. Using if-else

Object: Write a program that takes a number and checks whether the Number is even or odd. Using if-else. C++ Projects

Code:

#include<iostream>

#include<conio.h>

using namespace std;

void main()

{

int num1;

cout<<” Enter Any Number: “;

cin>>num1;

if(num1%2==0)

{

cout<<“\n Given Number is Even.”;

}

else

{

cout<<“\n Given Number is Odd.”;

}

getch();

}

#include<iostream>
#include<conio.h>
using namespace std;
void main()
{
	int num1;
	cout<<" Enter Any Number: ";
	cin>>num1;
	if(num1%2==0)
	{
		cout<<"\n Given Number is Even.";
	}
	else
	{
		cout<<"\n Given Number is Odd.";
	}
	getch();
}

Output:

Write a program that takes a number and checks whether the Number is even or odd. Using if-else

Write a program that takes a number and checks whether the Number is even or odd. Using if-else

C++ projects for beginners with source code

Leave a Comment

Your email address will not be published. Required fields are marked *