Advertisement
sivancheva

LefANdRightSUm

May 12th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. using System;
  2.  
  3. public class Program
  4. {
  5. public static void Main()
  6. {
  7. int n = int.Parse(Console.ReadLine());
  8. int leftSum=0;
  9. int rightSum=0;
  10.  
  11.  
  12. for (int i = 0; i<=n; i++)
  13.  
  14. {
  15. int numLeft = int.Parse(Console.ReadLine());
  16. leftSum += numLeft;
  17. }
  18. for (int i = 0; i<=n; i++)
  19.  
  20. {
  21. int numRight = int.Parse(Console.ReadLine());
  22. leftSum += numRight;
  23. }
  24.  
  25.  
  26. if (leftSum==rightSum)
  27. {
  28. Console.WriteLine("Yes, sum = {0}", Math.Abs(leftSum-rightSum));
  29. }
  30. else
  31. Console.WriteLine("No, diff = {0}", Math.Abs(leftSum-rightSum));
  32.  
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement