Skip to content

added odd even number check #125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions snippets/cpp/math-and-numbers/odd-even-check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: cpp, number, bitwise, even, odd
description : This code demonstrates the fastest way to check if a number is even or odd using bitwise operations. It's more efficient than using the modulor operator (%) since bitwise operations are performed at the CPU level.
tags : cpp, number, even, odd, bitwise
author : Beast177
---

```cpp

bool isEven(int num) {
return !(num & 1);
}

```

Loading