Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 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 ConsoleApp3
  8. {
  9. class Program
  10. {
  11. static Random r = new Random();
  12.  
  13. static void Main(string[] args)
  14. {
  15. int[][] mass;
  16. mass = new int [3][];
  17. int temp;
  18.  
  19.  
  20.  
  21. for (int i = 0; i < 3; i++)
  22. {
  23. mass[i] = new int[3];
  24. for (int j = 0; j < mass[i].Length; j++)
  25. {
  26. mass[i][j] = r.Next(1, 9);
  27. for (int y = j+1; y < mass[i].Length; y++)
  28. {
  29. if (mass[i][j] > mass[i][y])
  30. {
  31. temp = mass[i][j];
  32. mass[i][j] = mass[i][y];
  33. mass[i][y] = temp;
  34. }
  35. }
  36. }
  37.  
  38.  
  39. }
  40. for (int i = 0; i < 3; i++)
  41. {
  42.  
  43. for (int j = 0; j < mass.Length; j++)
  44. {
  45. Console.Write(mass[i][j]);
  46. }
  47. Console.WriteLine();
  48. }
  49.  
  50. Console.ReadKey();
  51.  
  52.  
  53. }
  54.  
  55. }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement