Advertisement
koksibg

Left_and_Right_Sum

Jul 9th, 2016
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.87 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Left_and_Right_Sum
  8. {
  9.     class Left_and_Right_Sum
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int n = int.Parse(Console.ReadLine());
  14.             int SumOne = 0;
  15.             int SumTwo = 0;
  16.             for (int i = 1; i <= n; i++)
  17.             {
  18.                 int First = int.Parse(Console.ReadLine());
  19.                 SumOne += First;
  20.             }
  21.             for (int j = 1; j <= n; j++)
  22.             {
  23.                 int Two = int.Parse(Console.ReadLine());
  24.                 SumTwo += Two;
  25.             }
  26.             int difference = Math.Abs(SumOne - SumTwo);
  27.             if (difference == 0) Console.WriteLine("Yes sum " + SumOne);
  28.             else Console.WriteLine("No diff " + difference);
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement