Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 71 additions & 1 deletion Lab1/White.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,75 @@ public bool Task1(double d)
bool answer = false;

// code here
static void Main(string[] args)
{
var rand = new Random();
int n = rand.Next(3, 10);
int m=rand.Next(3, 10);
int[,] task1 = new int[n, m];
for (int i=0; i<n;i++)
{
for (int j = 0; j < m; j++)
{
task1[i, j] = rand.Next(-9, 10);
}
}
Print(task1);
//for (int i = 0; i < array.Length; i++)

var jt = new int[5][]
{
new int[1] { 9 },
new int[2] { 1,3 },
new int[3] { 2,10,8 },
new int[4] {1,4,4,1 },
new int[5]{7,0,2,5,3},
};
int count = 0;
foreach (int[] arr in jt)
{
count += arr.Length;
}
int[]full=new int[count];
count = 0;
foreach(var arr in jt)
{
foreach(var elem in arr)
{
full[count++] = elem;
}
}
Array.Sort(full);
count = 0;
for (int i=0;i<jt.Length;i++)
{
for (int j = 0; j < jt[i].Length; j++)
{
jt[i][j] = full[count++];
Console.Write(jt[i][j] + "");
}
Console.WriteLine();

}





static void Print(int[,]matrix)
{
for (int i=0;i<matrix.GetLength(0);i++)
{
for (int j=0;j<matrix.GetLength(1);j++)
{
Console.Write(matrix[i,j] + " ");
}
Console.WriteLine();
}
Console.WriteLine(); //если return, вместо void пишем тип (например int[,])
}

}

// end

Expand Down Expand Up @@ -84,4 +153,5 @@ public bool Task8(double L, int T, int M)
return answer;
}
}
}

}
Loading