Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- using System.Numerics;
- using System.Text;
- namespace exampreparation
- {
- class exam
- {
- static void Main(string[] args)
- {
- List<int> numbers1 = Console.ReadLine().Split().Select(int.Parse).ToList();
- List<int> numbers2 = Console.ReadLine().Split().Select(int.Parse).ToList();
- if (numbers1.SequenceEqual(numbers2))
- {
- int sum = numbers1.Sum();
- Console.WriteLine($"Arrays are identical. Sum: {sum}");
- }
- else
- {
- for (int i = 0; i < numbers1.Count; i++)
- {
- if (numbers1[i] != numbers2[i])
- {
- Console.WriteLine($"Arrays are not identical. Found difference at {i} index");
- break;
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment