int calculation
In this chapter you will learn:
integers and arithmetic operators
class MainClass// j a v a 2 s .com
{
public static void Main()
{
System.Console.WriteLine("10 / 3 = " + 10 / 3);
System.Console.WriteLine("10 % 3 = " + 10 % 3);
int intValue1 = 10;
int intValue2 = 3;
System.Console.WriteLine("intValue1 / intValue2 = " + intValue1 / intValue2);
System.Console.WriteLine("intValue1 % intValue2 = " + intValue1 % intValue2);
}
}
The code above generates the following result.
Prefix and Postfix Increment Operators
class Main// j a v a 2 s .c o m
{
public static void Main()
{
int x;
x = 1;
System.Console.WriteLine("{0}, {1}, {2}", x++, x++, x);
System.Console.WriteLine("{0}, {1}, {2}", ++x, ++x, x);
}
}
Next chapter...
What you will learn in the next chapter:
Home » C# Tutorial » Byte, Integer, Long