Advertisement
A4L

Chapter - 05 - Variables

A4L
Dec 7th, 2018
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.34 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Variables
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             /* ************************
  14.              * ***** Integer Types ****
  15.              * ************************
  16.              * int = 2million(ish)
  17.              * byte = 0-255
  18.              * short = 32,000(ish)
  19.              * long = 9quintillion(ish)
  20.              *
  21.              * ushort, uint, ulong - unsigned (can not be negitive, thus doubling the positive range.
  22.              * sbytpe : byte is unsigned by default, so this allows negitive numbers by halving the positive range.
  23.             */
  24.             int theMeaningOfLife = 42;
  25.             Console.WriteLine("The Meaning of Life = "+theMeaningOfLife);
  26.  
  27.             byte baseTri = 5;
  28.             byte heightTri = 8;
  29.             float areaTri = baseTri * heightTri / 2;
  30.                        
  31.             Console.WriteLine("The Area of a triangle, with a base of 5 and height of 8 is : "+areaTri);
  32.  
  33.             int testOps = 5;
  34.             testOps++;
  35.             Console.WriteLine("++ == " + testOps);
  36.             testOps += testOps;
  37.             Console.WriteLine("var += var == " + testOps);
  38.  
  39.  
  40.  
  41.  
  42.             Console.ReadKey();
  43.         }
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement