![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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(); } } }
Advertisements