ulong
In this chapter you will learn:
ulong literal
using System;//from j a v a2 s .c o m
public class MainClass{
public static void Main() {
unsigned long ulVal = 0776745ul; // Unsigned long value
Console.WriteLine(ulVal);
}
}
Calculate with ulong
using System;//ja v a 2 s . co m
class MainClass
{
static void Main(string[] args)
{
ulong loopCount = 0;
ulong factorial = 1;
loopCount = 23;
for( ulong i = loopCount; i > 0; i-- )
{
factorial *= i;
}
Console.WriteLine( "{0}! = {1}", loopCount, factorial );
}
}
ulong format
Display value using the standard format specifiers for ulong value.
using System;//from j a v a 2s. c o m
public class Example
{
public static void Main()
{
ulong value = 163249057;
// Display value using default ToString method.
Console.WriteLine(value.ToString());
Console.WriteLine();
// Define an array of format specifiers.
string[] formats = { "G", "C", "D", "F", "N", "X" };
// Display value using the standard format specifiers.
foreach (string format in formats)
Console.WriteLine("{0} format specifier: {1,16}",format, value.ToString(format));
}
}
Next chapter...
What you will learn in the next chapter:
Home » C# Tutorial » Byte, Integer, Long