Advertisement
ntodorova

Arrays - 01_ArrayOf20int

Jan 12th, 2013
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.37 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement