Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. using System;
  2.  
  3. namespace HM
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. double[] arrValues = Array.ConvertAll<string, double>(Console.ReadLine().Split(new char[] { ' ' },
  10. StringSplitOptions.RemoveEmptyEntries), elem => { return System.Convert.ToDouble(elem); });
  11.  
  12. double floor = arrValues[0];
  13. double down = arrValues[1];
  14. double up = arrValues[2];
  15.  
  16. if (floor < 0 && (floor + (up - down)) >= 0)
  17. Console.WriteLine(floor + (up - down) + 1);
  18. else if (floor > 0 && (floor + (up - down)) <= 0)
  19. Console.WriteLine(floor + (up - down) - 1);
  20. else
  21. Console.WriteLine(floor + (up - down));
  22. }
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement