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 ConsoleApplication2
- {
- class Program
- {
- static void Main(string[] args)
- {
- Random generator = new Random();
- int[] losowe = new int[6];
- int tmp;
- for (int i=0; i<losowe.Length; i++)
- {
- losowe[i] = generator.Next(1, 50);
- //tutaj zmiana żeby nie było powtórzeń
- }
- for(int j=0; j<losowe.Length-1;j++)
- for(int i=0; i<losowe.Length-1; i++)
- if(losowe[i]>losowe[i+1])
- {
- tmp = losowe[i];
- losowe[i] = losowe[i + 1];
- losowe[i + 1] = tmp;
- }
- foreach(int liczba in losowe)
- {
- Console.Write("{0},", liczba);
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement