Programming QN
Programming QN
Write a program to create two multidimensional arrays of same size. Accept value
from user and store them in first array. Now copy all the elements of first array
are second array and print output.
using System;
class Program
{ static void Main()
{
// Get the size of the multidimensional array from the user
Console.Write("Enter the number of rows: ");
int rows = int.Parse(Console.ReadLine());
// Accept values from the user and store them in the first array
Console.WriteLine("Enter values for the first array:");
// Create the second array with the same size as the first array
int[,] secondArray = new int[rows, cols];
// Copy all elements from the first array to the second array
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < cols; j++)
{
secondArray[i, j] = firstArray[i, j];
}
}
using System;
class Program
{
static void Main()
{
Console.Write("Enter a string: ");
string inputString = Console.ReadLine();
QN2
:Write a program to create three multidimensional arrays of same size. Accept
value from user and store them in first array. Now copy all the elements of first
array are second array and print output.
using System;
class Program
{
static void Main()
{
Console.Write("Enter the number of rows and columns: ");
int size = int.Parse(Console.ReadLine());
// Create the first array and accept values from the user
int[,] firstArray = new int[size, size];
// Create the second and third arrays and copy elements from the first array
int[,] secondArray = new int[size, size];
int[,] thirdArray = new int[size, size];
QN3.
Write a program to copy one array’s elements to another array without using array
function.
using System;
class Program
{
static void Main()
{
Console.Write("Enter the size of the array: ");
int size = int.Parse(Console.ReadLine());
// Create the first array and accept values from the user
int[] firstArray = new int[size];