using System;
namespace MyCompiler {
class Program {
public static void Main(string[] args) {
//User input fileds for row and colums for row and column
Console.WriteLine("Enter number of rows:");
int rows = int.Parse(Console.ReadLine());
Console.WriteLine("Enter number of columns:");
int columns = int.Parse(Console.ReadLine());
//Initialize parameters used for the processing
// Initialize a 2D array
int[,] initialArr = new int[rows, columns];
// Input values for the initial matrix which is used for sorting the row anc columns elements
for (int rowVal = 0; rowVal < rows; rowVal++)
{
for (int colVal = 0; colVal < columns; colVal++)
{
Console.Write($"Enter value of element at ({rowVal + 1},{colVal + 1}): ");
initialArr[rowVal, colVal] = int.Parse(Console.ReadLine());
}
}
// // Sort the elements of the array
// // loop for rows of array
// for (int i = 0; i < rows; i++){
// // loop for column of array
// for (int j = 0; j < columns; j++){
// // loop for comparison and swapping the elements in array
// for (int k = 0; k < rows; k++){
// for (int l = 0; l < columns; l++){
// if (initialArr[i, j] < initialArr[k, l]){
// // Swap elements if they are out of order
// int temp = initialArr[i, j];
// initialArr[i, j] = initialArr[k, l];
// initialArr[k, l] = temp;
// }
// }
// }
// }
// }
// // Display the sorted array
// Console.WriteLine("\nSorted Array:");
for (int i = 0; i < rows; i++){
for (int j = 0; j < columns; j++){
Console.Write(initialArr[i, j] + " ");
}
Console.WriteLine();
}
}
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: