int binary operation
In this chapter you will learn:
Bitwise AND of Integer
using System;//java 2 s . co m
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter an integer:");
int myInt = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Bitwise AND of Integer and 10 = {0}", myInt & 10);
}
}
Shifting an integer value
using System;//j av a 2s. c o m
class MainClass8
{
static void Main()
{
int a = 1000;
a >>= 4;
Console.WriteLine(a);
}
}
Next chapter...
What you will learn in the next chapter:
- Int Parsing
- Converts string to integer and catch FormatException
- Parse and catch OverflowException
- Convert string value to integer by using the int.TryParse
- TryParse with while loop
Home » C# Tutorial » Byte, Integer, Long