brel-logo-white brel-logo-white
  • Travel
  • Case Study
  • How to
  • Technology
  • More
    • Sports
    • Health
    • Articles
    • Review
Notification
  • HomeHome
  • Finance
  • Health
  • Lifestyle
  • Sports
  • Contact Us
BreldigitalBreldigital
  • HomeHome
  • Finance
  • Health
  • Lifestyle
  • Sports
  • Contact Us
Search
  • Quick Access
    • Home
    • History
    • My Saves
    • My Interests
    • My Feed
  • Categories
    • Travel
    • Sports
    • Health

Top Stories

Explore the latest updated news!
Which scenario depicts two independent events?

Which scenario depicts two independent events?

What value would be returned based on the formula in cell d49

What value would be returned based on the formula in cell d49

the life cycle of a star reading answers

The life cycle of a star reading answers

Stay Connected

Find us on socials
248.1k Followers Like
61.1k Followers Follow
165k Subscribers Subscribe
Breldigital > Blog > ds > C++ check if number is even
ds

C++ check if number is even

Last updated: 2022/11/10 at 5:31 AM
By John
Share

This C+ +Program checks if a given integer is odd or even. Here if a given number is divisible by 2 with the remainder 0 then the number is even number. If the number is not divisible by 2 then that number will be odd number.
Here is source code of the C++ program which checks a given integer is odd or even. The C++ program is successfully compiled and run on a Linux system. The program output is also shown below.

/*
* C++ program to check if given integer is even or odd
*/
#include
using namespace std;

int main()
{
int number, remainder;

cout << "Enter the number : "; cin >> number;
remainder = number % 2;
if (remainder == 0)
cout << number << " is an even integer " << endl; else cout << number << " is an odd integer " << endl; return 0; } $ g++ main.cpp $ ./a.out Enter the number : 3 3 is an odd integer $ ./a.out Enter the number : 10 10 is an even integer

TAGGED: C++ check if number is even
John November 10, 2022 November 10, 2022

Search

brel-logo-white brel-logo-white
Explore a wide range of brands and categories with our comprehensive coverage, and stay up-to-date with the latest news and trends by subscribing to our updates.
Categories:
  • Entertainment
  • Travel
  • Sport
  • Contact Us

Quick Links

  • My Feed
  • My Interests
  • History
  • My Saves

About US

  • Adverts
  • Our Jobs
  • Term of Use

© 2023 Brel Digital All Rights Reserved. All logos and images used on this website are registered trademarks of their respective companies

Welcome Back!

Sign in to your account

Lost your password?