Advertisement
adriyanbulgary

PrimitiveDataTypesAndVariablesC#

May 29th, 2014
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.82 KB | None | 0 0
  1. using System;
  2. /*
  3.  *Declare five variables choosing for each of them the most appropriate of the types byte, sbyte,
  4.  *short, ushort, int, uint, long, ulong *to represent the following values: 52130, -115, 4825932,
  5.  *97, -10000.  *Choose a large enough type for each number to ensure it will fit in it.
  6.  */
  7. class DeclareVariables
  8. {
  9.     static void Main()
  10.     {
  11.         byte a = 97;
  12.         sbyte b = -115;
  13.         short c = -10000;
  14.         ushort d = 52130;
  15.         uint e = 4825932;
  16.         long f = -1323111212331232131;
  17.         ulong g = 18318496518131848651;
  18.         Console.WriteLine(" byte numb -> {0} \n sbyte numb -> {1} \n short numb -> {2}", a, b, c);
  19.         Console.WriteLine(" ushort numb -> {0} \n int numb -> {1}", d, e);
  20.         Console.WriteLine(" long num -> {0} \n ulong numb -> {1}",f,g);
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement