

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Bitwise right shift operators in C#
Bitwise operator works on bits and performs bit by bit operation. In Bitwise right shift operator the value of the left operand is moved right by the number of bits specified by the right operand.
In the below code, we have the value −
60 i.e. 0011 1100
On the right shift %minus;
c = a >> 2;
It converts into 15 after right shift twice −
15 i.e. 0000 1111
Example
You can try to run the following code to implement Bitwise right shift operator in C# −
using System; using System.Collections.Generic; using System.Text; namespace Demo { class toBinary { static void Main(string[] args) { int a = 60; /* 60 = 0011 1100 */ int b = 0; c = a >> 2; /* 15 = 0000 1111 */ Console.WriteLine("Value of b is {0}", b); Console.ReadLine(); } } }
- Related Questions & Answers
- Bitwise right shift operator in Java
- What are the bitwise zero fill right shift zero operators in Java?
- C# Bitwise and Bit Shift Operators
- Explain JavaScript Bitwise NOT, Left shift and Right shift?
- Bitwise Right/ left shift numbers in Arduino
- Left Shift and Right Shift Operators in C/C++
- What is JavaScript Bitwise Right Shift(>>) Operator?
- What does the bitwise right shift operator do in Java?
- What is Bitwise Right Shift Operator (>>) in JavaScript?
- Java Shift operators
- What are Left Shift and Right Shift Operators (>> and <<) in C#?
- Java Bitwise Operators
- Perl Bitwise Operators
- Python Bitwise Operators
- Bitwise Operators in C++
Advertisements