SHARE
TWEET

C# Part 2 - Arrays - Exercise 1

cherokee Jan 5th, 2013 19 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. class TwentyIntegers
  4. {
  5.     static void Main()
  6.     {
  7.         // Write a program that allocates array of 20 integers and initializes each element by its index multiplied by 5.
  8.         // Print the obtained array on the console.
  9.  
  10.         int[] arrayNumbers = new int[20];
  11.         for (int i = 0; i < arrayNumbers.Length; i++)
  12.         {
  13.             arrayNumbers[i] = i * 5;
  14.             Console.Write("{0} ", arrayNumbers[i]);
  15.         }
  16.         Console.WriteLine();
  17.     }
  18. }
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