andreykata

ArraysExercise02

Jan 12th, 2013
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.11 KB | None | 0 0
  1. using System;
  2.  
  3.     class Exercise02
  4.     {
  5.         static void Main(string[] args)
  6.         {
  7.             Console.WriteLine("The lenght of the arrays is:");
  8.             int n = int.Parse(Console.ReadLine());
  9.             int[] arrayOne = new int[n];
  10.             int[] arrayTwo = new int[n];
  11.             Console.WriteLine("Elements of a first array:");
  12.             for (int i = 0; i < n; i++)
  13.             {
  14.                 arrayOne[i] = int.Parse(Console.ReadLine());
  15.             }
  16.             Console.WriteLine("Elements of a second array:");
  17.             for (int i = 0; i < n; i++)
  18.             {
  19.                 arrayTwo[i] = int.Parse(Console.ReadLine());
  20.             }
  21.             for (int i = 0; i < n; i++)
  22.             {
  23.                 if (arrayOne[i] == arrayTwo[i])
  24.                 {
  25.                     Console.WriteLine("The elements arrayOne[{0}] and arrayOne[{0}] are equal", i);
  26.                 }
  27.                 else
  28.                 {
  29.                     Console.WriteLine("The elements arrayOne[{0}] and arrayOne[{0}] are NOT equal", i);
  30.                 }
  31.             }
  32.         }
  33.     }
Advertisement
Add Comment
Please, Sign In to add comment