Advertisement
stambeto09

.ArrayMutipliedIndexByFive

Dec 15th, 2013
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.66 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4.  
  5. namespace _01.ArrayMutipliedIndexByFive
  6. {
  7.     class ArrayMutipliedIndexByFive
  8.     {   //Write a program that allocates array of 20 integers and initializes each element by its index multiplied by 5. Print the obtained array on the console.
  9.  
  10.         static void Main()
  11.         {  
  12.             //Declaring the array
  13.             int[] array = new int[20];
  14.  
  15.             //Multiplying the array index with five;
  16.             for (int index = 0; index < array.Length; index++)
  17.             {
  18.                 array[index] = index * 5;
  19.                 Console.WriteLine(array[index]);
  20.             }
  21.  
  22.  
  23.  
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement