ulong keyword in C#In this article, we will discuss the ulong keyword in C# with its features, syntax, and examples. What is the ulong Keyword?In C#, variables or parameters of type "unsigned long" are declared with the keyword "ulong". ULONG is a 64-bit unsigned integer data type that can store integer values between 0 and 18,446,744,073,709,551,615 (inclusive). As it is unsigned, it cannot represent negative integers. Positive or zero is always applicable. Positive or zero is always applicable. Features of the ulong keyword:Several features of the ulong Keyword in C# are as follows:
Key Points to Remember:
Syntax:It has the following syntax: Example 1:Let us take an example to illustrate the ulong keyword in C#. Output: The value of the Integer: 223 The size of a ulong variable is: 8 Explanation: In this example, the main goal of this code is to create an ulong variable, initialize it with a value, print the value, and finally print the byte size of the ulong data type. Example 2:Let us take another example to illustrate the ulong keyword in C#. Output: The First value is: 1854828373929102938 The Second value is: 3647826289303678294 The type of num_1 is: System.UInt64 The type of num_2 is: System.UInt64 The sum of the two numbers is: 5502654663232781232 The difference between the two numbers is: 16653746158334976260 The product of two numbers is : 11324999253036770364 The quotient is : 0 The remainder is: 1854828373929102938 The minimum value of the ulong is : 0 The maximum value of the ulong is: 18446744073709551615 Explanation: This C# code defines a class called Javatpoint, whose entry point is the Main method. The program initializes two ulong variables, num_1 and num_2, applies addition, subtraction, multiplication, division, and modulo operations to them, and outputs the results together with the data types of each and the minimum and maximum values of ulong. Furthermore, an ulong literal is indicated by the UL suffix. Next TopicConsole.SetWindowSize() Method in C# |