two left
This commit is contained in:
21
labs/lab5_done/SizedArray/Program.cs
Normal file
21
labs/lab5_done/SizedArray/Program.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
int[] myArray;
|
||||
Console.WriteLine("input an amount of elements: ");
|
||||
int n = int.Parse(Console.ReadLine());
|
||||
Console.WriteLine("input elements one by one: ");
|
||||
myArray = new int[n];
|
||||
|
||||
for (int i = 0; i < myArray.Length; ++i)
|
||||
{
|
||||
Console.Write("a[{0}] = ", i);
|
||||
myArray[i] = int.Parse(Console.ReadLine());
|
||||
}
|
||||
|
||||
foreach (int x in myArray) Console.Write("{0} ", x);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user