Advertisement
svetlyoek

Untitled

Feb 5th, 2019
513
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. namespace ConsoleApp154
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int[] firstArray = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
  10. int[] secondArray = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
  11. int sum = 0;
  12.  
  13.  
  14.  
  15.  
  16. for (int i = 0; i < firstArray.Length; i++)
  17. {
  18.  
  19. sum += firstArray[i];
  20.  
  21.  
  22.  
  23. if (firstArray[i] != secondArray[i])
  24. {
  25. Console.WriteLine($"Arrays are not identical. Found difference at {i} index");
  26. return;
  27. }
  28. }
  29. sum = firstArray.Sum();
  30.  
  31.  
  32.  
  33.  
  34. Console.WriteLine($"Arrays are identical. Sum: {sum}");
  35. }
  36.  
  37.  
  38.  
  39.  
  40.  
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement