Advertisement
nahidjamalli

Lesson #1

Feb 14th, 2020
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.78 KB | None | 0 0
  1. namespace MyNamespace
  2. {
  3.     class MyClass
  4.     {
  5.         static void Main(string[] args)
  6.         {
  7.             // Array Initializing
  8.  
  9.             // 9, 6, 0, 2, 3
  10.             int[] arr1 = new int[5];
  11.  
  12.             // Access array index method #1
  13.             arr1[0] = 9;
  14.             arr1[1] = 6;
  15.             arr1[2] = 0;
  16.             arr1[3] = 2;
  17.             arr1[4] = 3;
  18.  
  19.             // Access array index method #2
  20.             int[] arr2 = new int[5] { 9, 6, 0, 2, 3 };
  21.  
  22.             // Access array index method #3
  23.             int[] arr3 = { 9, 6, 0, 2, 3 };
  24.  
  25.             float f1 = 4.7f; // FLOAT TYPE <=> FLOAT VALUE
  26.             double d1 = 4.7f; // DOUBLE TYPE <=> FLOAT VALUE
  27.  
  28.             float f2 = 4.7; // ERROR! FOAT TYPE <=> DOUBLE VALUE
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement