Professional Documents
Culture Documents
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
int N;
int.TryParse(Console.ReadLine(), out N);
Thread.Sleep(1000);
Console.Clear();
int[] arr = { 0 };
switch (N)
{
case 1:
arr = new int[10];
Random random = new Random();
for (int i = 0; i < arr.Length; i++)
{
arr[i] = random.Next(0, 100);
}
break;
case 2:
Console.WriteLine("Introduceti numarul de elemente ");
int nrOfElements;
int.TryParse(Console.ReadLine(), out nrOfElements);
break;
default:
Console.WriteLine("Valoare incorecta");
break;
Console.SetCursorPosition(2, 2);
for (int i = 0; i < arr.Length; i++)
{
writeNums(arr, i, j, ConsoleColor.Blue);
Thread.Sleep(1000);
Thread.Sleep(100);
}
Console.Clear();
writeNums(arr, i, j, ConsoleColor.Red);
Thread.Sleep(1000);
}
}
}
writeResult(arr, 6);
Console.ReadKey();
}
}
}
public static void writeNum(int[] arr, int pos, int index, int line)
{
Console.SetCursorPosition(0, line);
ClearCurrentConsoleLine();
Console.SetCursorPosition(pos, line);
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(arr[index]);
Console.ForegroundColor = ConsoleColor.White;
}