Skip to content

Commit b2caf4e

Browse files
committed
added odd even number check
1 parent 0c20114 commit b2caf4e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: cpp, number, bitwise, even, odd
3+
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.
4+
tags : cpp, number, even, odd, bitwise
5+
author : Beast177
6+
---
7+
8+
```cpp
9+
10+
bool isEven(int num) {
11+
return !(num & 1);
12+
}
13+
14+
```
15+

0 commit comments

Comments
 (0)