Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2016
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 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 EqualNumbers
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. var count = int.Parse(Console.ReadLine());
  14. double previousPairSum = 0;
  15. double currentPairSum = 0;
  16. double difference = 0;
  17. double biggestdifference = 1;
  18. for (int i = 1; i <= count; i++)
  19. {
  20. currentPairSum = previousPairSum;
  21. var num1 = int.Parse(Console.ReadLine());
  22. var num2 = int.Parse(Console.ReadLine());
  23. previousPairSum = num1 + num2;
  24. biggestdifference = Math.Abs(previousPairSum - currentPairSum);
  25. if (biggestdifference > difference & i >= 2)
  26. {
  27. difference = biggestdifference;
  28. }
  29. }
  30. if (difference == 0)
  31. {
  32. Console.WriteLine("Yes value = {0}", previousPairSum);
  33. }
  34. else
  35. {
  36. Console.WriteLine("No maxdiff = {0}", difference);
  37. }
  38. }
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement