SHARE
TWEET

01. SimpleArray

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