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