Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using static System.Console;
- class Program
- {
- public static void Main(string[] args)
- {
- Random rd = new Random();
- int[] a = new int[10];
- for (int i = 0; i < a.Length; i++)
- {
- a[i] = rd.Next(-50, 50);
- Write(a[i] + " ");
- }
- do
- {
- WriteLine("Enter index");
- int pos = int.Parse(ReadLine());
- int[] temp = new int[a.Length - 1];
- if (pos < 0 || pos > a.Length) { continue; }
- for (int i = 0; i < pos; i++)
- {
- temp[i] = a[i];
- }
- for (int i = pos; i < temp.Length; i++)
- {
- temp[i] = a[i + 1];
- }
- a = temp;
- foreach (int x in a)
- {
- Write(x + " ");
- }
- WriteLine();
- } while (true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement