Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace ConsoleApp154
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] firstArray = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
- int[] secondArray = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
- int sum = 0;
- for (int i = 0; i < firstArray.Length; i++)
- {
- sum += firstArray[i];
- if (firstArray[i] != secondArray[i])
- {
- Console.WriteLine($"Arrays are not identical. Found difference at {i} index");
- return;
- }
- }
- sum = firstArray.Sum();
- Console.WriteLine($"Arrays are identical. Sum: {sum}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement