Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Left and Right Sum
- {
- class Program
- {
- static void Main(string[] args)
- {
- int howMany = int.Parse(Console.ReadLine());
- int sumLeft = 0;
- int sumRight = 0;
- int number = 0;
- for (int i = 0; i < 2 * howMany; i++)
- {
- number = int.Parse(Console.ReadLine());
- if (i < howMany)
- {
- sumLeft += number;
- }
- else
- {
- sumRight += number;
- }
- }
- if (sumRight==sumLeft)
- {
- Console.WriteLine($"Yes, sum = {sumLeft}");
- }
- else
- {
- Console.WriteLine($"No, diff = {Math.Abs(sumLeft-sumRight)}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement