nKolchakoV

IndexMultipliedBy5

Dec 7th, 2013
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.39 KB | None | 0 0
  1.  
  2. //Write a program that allocates array of 20 integers and initializes each element by its index multiplied by 5.
  3. //Print the obtained array on the console.
  4. using System;
  5. class Program
  6. {
  7.     static void Main()
  8.     {
  9.         int[] array = new int[20];
  10.         for (int i = 0; i < array.Length; i++)
  11.         {
  12.             Console.WriteLine("array [{0}] = {1}",i,i*5);
  13.         }
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment