Skip to content

Commit

Permalink
Merge pull request #33 from justanindieguy/LeftRightShift
Browse files Browse the repository at this point in the history
LeftRightShift
  • Loading branch information
justanindieguy authored Jan 17, 2023
2 parents a7a9b73 + a374456 commit c7f6eec
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Bit-manipulationTechniques/LeftRightShift/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <iostream>

using namespace std;

int main()
{
int num = 10;

// a * b^2
cout << "Left Shift Operator: " << (num << 2) << endl;

// a / b^2
cout << "Right Shift Operator: " << (num >> 2) << endl;

return 0;
}
12 changes: 12 additions & 0 deletions Bit-manipulationTechniques/LeftRightShift/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
def main():
num = 10

# a * 2^b
print("Left Shift Operator:", num << 2)

# a / 2^b
print("Right Shift Operator:", num >> 2)


if __name__ == "__main__":
main()

0 comments on commit c7f6eec

Please sign in to comment.