A
Arash_89
Guest
Hello,
How can I remove row and column in Display method? Can I have row and column in Arr variable without row and column parameter?
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApp1
{
class Program
{
static void Display(int[,] Arr,int row,int column)
{
for (int i = 0; i < row; i++)
{
for (int j = 0; j < column; j++)
{
Console.Write($"{Arr[i,j]} ");
}
Console.WriteLine();
}
}
static void Main(string[] args)
{
Console.WriteLine("Enter Row");
int Row = int.Parse(Console.ReadLine());
Console.WriteLine("Enter Column");
int Column = int.Parse(Console.ReadLine());
int[,] myArray = new int[Row,Column];
for (int i = 0; i < Row; i++)
{
for (int j = 0; j < Column; j++)
{
Console.WriteLine($"Enter Element {i}{j}");
myArray[i, j] = int.Parse(Console.ReadLine());
}
}
Display(myArray,Row,Column);
}
}
}
Continue reading...
How can I remove row and column in Display method? Can I have row and column in Arr variable without row and column parameter?
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApp1
{
class Program
{
static void Display(int[,] Arr,int row,int column)
{
for (int i = 0; i < row; i++)
{
for (int j = 0; j < column; j++)
{
Console.Write($"{Arr[i,j]} ");
}
Console.WriteLine();
}
}
static void Main(string[] args)
{
Console.WriteLine("Enter Row");
int Row = int.Parse(Console.ReadLine());
Console.WriteLine("Enter Column");
int Column = int.Parse(Console.ReadLine());
int[,] myArray = new int[Row,Column];
for (int i = 0; i < Row; i++)
{
for (int j = 0; j < Column; j++)
{
Console.WriteLine($"Enter Element {i}{j}");
myArray[i, j] = int.Parse(Console.ReadLine());
}
}
Display(myArray,Row,Column);
}
}
}
Continue reading...