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 _07_Left_and_Right_Sum
- {
- class LeftAndRightS
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- int leftSum = 0;
- int rightSum = 0;
- for (int i = 0; i < n; i++)
- {
- leftSum = leftSum + int.Parse(Console.ReadLine());
- }
- for (int i = 0; i < n; i++)
- {
- rightSum = rightSum + int.Parse(Console.ReadLine());
- }
- if (leftSum == rightSum)
- {
- Console.WriteLine("Yes, sum = {0}" , leftSum);
- }
- else
- {
- Console.WriteLine("No, diff = " + Math.Abs(leftSum - rightSum));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment