# Difference between Int16 and UInt16 in C#

Last Updated : 26 May, 2020

Int16: This Struct is used to represents 16-bit signed integer. The Int16 can store both types of values including negative and positive between the ranges of -32768 to +32767.

Example :

## C#

 `// C# program to show the ` `// difference between Int16 ` `// and UInt16 ` ` `  `using` `System; ` `using` `System.Text; ` ` `  `public` `class` `GFG { ` ` `  `  ``// Main Method ` `  ``static` `void` `Main(``string``[] args) { ` ` `  `    ``// printing minimum & maximum values ` `    ``Console.WriteLine(``"Minimum value of Int16: "`  `                      ``+ Int16.MinValue); ` `    ``Console.WriteLine(``"Maximum value of Int16: "`  `                      ``+ Int16.MaxValue); ` `    ``Console.WriteLine(); ` ` `  `    ``// Int16 array ` `    ``Int16[] arr1 = {-3, 0, 1, 3, 7}; ` ` `  `    ``foreach` `(Int16 i ``in` `arr1) ` `    ``{  ` `      ``Console.WriteLine(i); ` `    ``} ` `  ``} ` `}`

Output:

```Minimum value of Int16: -32768
Maximum value of Int16: 32767

-3
0
1
3
7
```

UInt16: This Struct is used to represents 16-bit unsigned integer. The UInt16 can store only positive value only which ranges from 0 to 65535.

Example :

## C#

 `// C# program to show the  ` `// difference between Int16  ` `// and UInt16 ` ` `  `using` `System; ` `using` `System.Text; ` ` `  `public` `class` `GFG{ ` `     `  `    ``// Main Method ` `    ``static` `void` `Main(``string``[] args) ` `    ``{ ` ` `  `        ``// printing minimum & maximum values ` `        ``Console.WriteLine(``"Minimum value of UInt16: "` `                          ``+ UInt16.MinValue); ` `        ``Console.WriteLine(``"Maximum value of UInt16: "` `                          ``+ UInt16.MaxValue); ` `        ``Console.WriteLine(); ` `         `  `        ``// Int16 array ` `        ``UInt16[] arr1 = { 13, 0, 1, 3, 7}; ` `         `  `        ``foreach` `(UInt16 i ``in` `arr1) ` `        ``{ ` `            ``Console.WriteLine(i); ` `        ``} ` `    ``} ` `}`

Output:

```Minimum value of UInt16: 0
Maximum value of UInt16: 65535

13
0
1
3
7
```

Differences between Int16 and UInt16in C#

Previous
Next