Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace straithselection
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int[] mas = new int[5];
  14. int minIdx, temp;
  15. for (int a = 0; a <mas.Length; a++)
  16. {
  17. mas[a] = Convert.ToInt32(Console.ReadLine().ToString());
  18. }
  19. for (int i = 0; i < mas.Length - 1; i++)
  20. {
  21. minIdx = i;
  22. for (int j = i + 1; j < mas.Length; j++)
  23. {
  24. if (mas[minIdx] > mas[j])
  25. {
  26. minIdx = j;
  27. }
  28. }
  29. temp = mas[i];
  30. mas[i] = mas[minIdx];
  31. mas[minIdx] = temp;
  32. }
  33. foreach (int el in mas)
  34. {
  35. Console.WriteLine(el);
  36. }
  37. Console.ReadLine();
  38. }
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement