Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,933 questions

51,870 answers

573 users

How to use right shift (>>) operator in VB.NET

1 Answer

0 votes
Imports System

Public Class Program
    Public Shared Sub Main()
        Dim pattern As Short = 3072
		Dim result1, result2, result3, result4, result5 As Short
		
		Console.WriteLine(Convert.ToString(pattern, 2).PadLeft(16, "0"c))
		
		result1 = pattern >> 0
		result2 = pattern >> 4
		result3 = pattern >> 9
		result4 = pattern >> 14
		result5 = pattern >> -1
	
		Console.WriteLine(Convert.ToString(result1, 2).PadLeft(16, "0"c) & " " & result1)
		Console.WriteLine(Convert.ToString(result2, 2).PadLeft(16, "0"c) & " " & result2)
		Console.WriteLine(Convert.ToString(result3, 2).PadLeft(16, "0"c) & " " & result3)
		Console.WriteLine(Convert.ToString(result4, 2).PadLeft(16, "0"c) & " " & result4)
		Console.WriteLine(Convert.ToString(result5, 2).PadLeft(16, "0"c) & " " & result5)

    End Sub
End Class





' run:
'
' 0000110000000000
' 0000110000000000 3072
' 0000000011000000 192
' 0000000000000110 6
' 0000000000000000 0
' 0000000000000000 0
'

 



answered Aug 25, 2023 by avibootz

Related questions

1 answer 116 views
1 answer 127 views
127 views asked Sep 13, 2021 by avibootz
3 answers 210 views
1 answer 169 views
...