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;
- using System.Threading.Tasks;
- namespace ConsoleApp9
- {
- class Program
- {
- static void Main(string[] args)
- {
- Random generator = new Random();
- int[] tablica = new int[6];
- int tmp;
- Console.Write("Podaj liczbę kuponów ");
- int ile_kuponow = Convert.ToInt16(Console.ReadLine()), k;
- for (k = 1; k <= ile_kuponow; k++)
- {
- for (int i = 0; i < tablica.Length; i++)
- {
- tablica[i] = generator.Next(1, 50);
- for (int j = 0; j < i; j++)
- {
- if (tablica[i] == tablica[j]) i--;
- }
- }
- foreach (int posortowane in tablica)
- {
- for (int i = 0; i < tablica.Length - 1; i++)
- {
- if (tablica[i] > tablica[i + 1])
- {
- tmp = tablica[i];
- tablica[i] = tablica[i + 1];
- tablica[i + 1] = tmp;
- }
- }
- }
- foreach (int losowa in tablica)
- {
- Console.Write("{0}\t", losowa);
- }
- Console.WriteLine();
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement