Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace LeftAndRighSide
- {
- class LeftAndRightSide
- {
- static void Main(string[] args)
- {
- int left = int.Parse(Console.ReadLine());
- int leftSum = 0;
- int rightSum = 0;
- for (int i = 0; i < left; i++)
- {
- int n = int.Parse(Console.ReadLine());
- leftSum += n;
- }
- for (int i = 0; i < left; i++)
- {
- int n = int.Parse(Console.ReadLine());
- rightSum += n;
- }
- int leftAndRight = Math.Abs(leftSum - rightSum);
- if(leftAndRight == 0)
- {
- Console.WriteLine("Yes, sum = {0}", rightSum);
- }
- else
- {
- Console.WriteLine("No, diff = {0}", leftAndRight);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment