I have used Visual Studio 2012 for debugging purpose. But you can use any version of visul studio as per your availability.
using System;
class Program
{
static void Main()
{
int[] arr = new int[100];
int[] first = new int[100];
int[] second = new int[100];
int i, num;
//Reads size of the array
Console.WriteLine("Enter size of the array: ");
num = Convert.ToInt32(Console.ReadLine());
//Reads elements in array
Console.WriteLine("Enter elements in the array: ");
for (i = 0; i < num; i++)
{
first[i] = Convert.ToInt32(Console.ReadLine());
}
//Copy all elements from first array to second array
for (i = 0; i < num; i++)
{
second[i] = first[i];
}
//Printing all elements of first array entered by user
Console.WriteLine("Elements of first array are:");
for (i = 0; i < num; i++)
{
Console.Write(first[i]+"\t");
}
//Printing all elements of second array
Console.WriteLine("\nElements of second array are:");
for (i = 0; i < num; i++)
{
Console.Write(second[i]+ "\t");
}
Console.ReadLine();
}
}
I have used Visual Studio 2012 for debugging purpose. But you can use any version of visul studio as per your availability.
Result:
Enter size of the array:
5
Enter elements in the array:
1
2
3
4
5
Elements of first array are:
1 2 3 4 5
Elements of second array are:
1 2 3 4 5
need an explanation for this answer? contact us directly to get an explanation for this answer