Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace ConsoleTesting
- {
- internal class ConsoleTesting
- {
- private static void Main()
- {
- Console.Write("Enter the length of first array: ");
- int n = int.Parse(Console.ReadLine());
- Console.Write("Enter the length of second array: ");
- int p = int.Parse(Console.ReadLine());
- if (n != p)
- {
- Console.WriteLine("Array Lengths are not equal!");
- }
- else
- {
- var arrayOne = new int[n];
- var arrayTwo = new int[p];
- for (int i = 0; i < n; i++)
- {
- Console.Write("Enter int for index \"{0}\" in Array One: ", i);
- arrayOne[i] = int.Parse(Console.ReadLine());
- }
- for (int i = 0; i < p; i++)
- {
- Console.Write("Enter int for index \"{0}\" in Array Two: ", i);
- arrayTwo[i] = int.Parse(Console.ReadLine());
- }
- bool isEqual = arrayOne.SequenceEqual(arrayTwo);
- if (isEqual)
- {
- Console.WriteLine("Both arrays are equal!");
- }
- else
- {
- Console.WriteLine("Arrays are not equal!");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment