Venciity

[ Telerik C#] Primitives And Variables - EX 1

Feb 13th, 2014
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.76 KB | None | 0 0
  1. // 1. Declare five variables choosing for each of them the most appropriate of the types
  2. // byte, sbyte, short, ushort, int, uint, long, ulong to represent the following
  3. // values: 52130, -115, 4825932, 97, -10000.
  4.  
  5. using System;
  6.  
  7. namespace _01_DataTypes
  8. {
  9.     class DataTypes
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             byte var1 = 97;     // because the number is lower than 127
  14.             sbyte var2 = -115;  // because the number is between -128 and +128
  15.             short var3 = 10000; // because the number is between -32768 and +32767
  16.             ushort var4 = 52130;// because the number is between 0 and 65535
  17.             int var5 = 4825932; // because the number is between -2147483648 and +2147483647
  18.         }
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment