How to shift bits right in C#

1 Answer

0 votes
using System;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = 64;

            for (int i = 0; i < 5; i++)
            {
                int shift = n >> i;
                Console.WriteLine(shift);
            }
        }
    }
}


/*
run:
    
64
32
16
8
4

*/

 



answered Feb 14, 2017 by avibootz

Related questions

2 answers 195 views
195 views asked Nov 2, 2016 by avibootz
...