Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /******************************************************************************
- Welcome to GDB Online.
- GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby,
- C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS
- Code, Compile, Run and Debug online from anywhere in world.
- *******************************************************************************/
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication4
- {
- class Program
- {
- static void printmas(int[] a)
- {
- for(int i=0;i< a.Length;i++)
- Console.Write(a[i]+" ");
- return;
- }
- static void randmas(int[] a)
- {
- Random rnd =new Random();
- for(int b=0;b<a.Length;b++)
- a[b]=rnd.Next(10);
- return ;
- }
- static void sort(int[] a)
- {
- int min;
- for (int i = 0; i < a.Length-1; i++)
- {
- for (int j = i + 1; j < a.Length; j++)
- {
- if (a[i] > a[j])
- {
- min = a[i];
- a[i] = a[j];
- a[j] = min;
- }
- }
- }
- return ;
- }
- static void Main(string[] args)
- {
- int[] a= new int[5];
- randmas(a);
- printmas(a);
- sort(a);
- Console.WriteLine();
- printmas(a);
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement