If you are a c# beginner or want to start learning the c# programming language, then this program will help you to understand the basics of c# programming. In this program, we are going to share C# program to illustrate leftShift operations.
Copy the below c# program and execute it in your Microsoft Visual Studio IDE (Integrated Development Environment ).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | using System; class leftShiftPrograms { public static void Main() { int x = 1024 * 1024 * 1024; uint p = 1024 * 1024 * 1024; int y = -42; Console.WriteLine("LEFT SHIFT OPERATIONS :"); Console.WriteLine("{0},{1},{2}", x, x * 2, x << 1); Console.WriteLine("{0},{1},{2}", p, p * 2, p << 1); Console.WriteLine("{0},{1},{2}", x, x * 4, x << 2); Console.WriteLine("{0},{1},{2}", p, p * 4, p << 2); Console.WriteLine("{0},{1},{2}", y, y * 1024 * 1024 * 64, x << 26); Console.ReadLine(); } } |
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.