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

Hi, I am M.A Siddiqui. I'm a Computer Science Student, In this website, I'm teaching you Multiple languages and provides Projects and other Subjects Notes.

You may also like...

Leave a Reply

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