SHARE
TWEET

Arrays - 01_ArrayOf20int

ntodorova Jan 12th, 2013 153 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. /*
  4.  * 1. Write a program that allocates array of 20 integers and initializes each element by
  5.  * its index multiplied by 5. Print the obtained array on the console.
  6.  */
  7. class ArrayOf20int
  8. {
  9.         static void Main()
  10.         {
  11.                 int[] arr = new int[20];
  12.  
  13.                 for (int i = 0; i < arr.Length; i++)
  14.                 {
  15.                         arr[i] = i * 5;
  16.                         Console.WriteLine(arr[i]);
  17.                 }
  18.         }
  19. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top