Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<int> lista = new List<int>();
- Random vel = new Random();
- int j = 0;
- while (j < 20)
- {
- int num = vel.Next(10, 100);
- if (!lista.Contains(num))
- {
- lista.Add(num);
- j++;
- }
- }
- /*for(int i = 0; i < 20; i++)
- {
- lista.Add(vel.Next(10, 100));
- }*/
- for (int i = lista.Count - 1; i >= 0; i--)
- {
- if (lista[i] % 2 != 0)
- {
- lista.RemoveAt(i);
- }
- }
- lista.Sort();
- lista.Insert(0, 123);
- foreach (int i in lista)
- {
- Console.Write("{0} ", i);
- }
- Console.WriteLine("\nMin = {0}\nMax = {1}\nOsszeg = {2}\nAtlag = {3}", lista.Min(), lista.Max(), lista.Sum(), (double)lista.Average());
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement