using System;
public class InitArray
{
public static void Main( string[] args )
{
int arrayLength = Convert.ToInt32( args[ 0 ] );
int[] array = new int[ arrayLength ]; // create array
int initialValue = Convert.ToInt32( args[ 1 ] );
int increment = Convert.ToInt32( args[ 2 ] );
for ( int counter = 0; counter < array.Length; counter++ )
array[ counter ] = initialValue + increment * counter;
Console.WriteLine( "{0}{1,8}", "Index", "Value" );
for ( int counter = 0; counter < array.Length; counter++ )
Console.WriteLine( "{0,5}{1,8}", counter, array[ counter ] );
}
}
|