Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 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. }
  28.  
  29.  
  30. }
  31. for (int i = 0; i < 3; i++)
  32. {
  33.  
  34. for (int j = 0; j < mass[i].Length; j++)
  35. {
  36.  
  37. for (int y = j + 1; y < mass[i].Length; y++)
  38. {
  39. if (mass[i][j] > mass[i][y])
  40. {
  41. temp = mass[i][j];
  42. mass[i][j] = mass[i][y];
  43. mass[i][y] = temp;
  44. }
  45. }
  46. }
  47.  
  48.  
  49. }
  50. for (int i = 0; i < 3; i++)
  51. {
  52.  
  53. for (int j = 0; j < mass.Length; j++)
  54. {
  55. Console.Write(mass[i][j]);
  56. }
  57. Console.WriteLine();
  58. }
  59.  
  60. Console.ReadKey();
  61.  
  62.  
  63. }
  64.  
  65. }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement