Guest User

Untitled

a guest
Apr 21st, 2016
1,966
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1.  
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace ConsoleApplication7
  9. {
  10. class Program
  11. {
  12. static void Main(string[] args)
  13. {
  14. int n = int.Parse(Console.ReadLine());
  15. int left = 0;
  16. int right = 0;
  17. int sum = 0;
  18.  
  19. for (int i = 0; i < n; i++)
  20. {
  21. sum = int.Parse(Console.ReadLine());
  22. left += sum;
  23. }
  24. for (int i = 0; i < n; i++)
  25. {
  26. sum = int.Parse(Console.ReadLine());
  27. right += sum;
  28. }
  29.  
  30. if(left == right)
  31. Console.WriteLine("Yes, sum = {0}" , left);
  32. else Console.WriteLine("No, diff = {0}" , Math.Abs(left - right));
  33.  
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment