Guest User

Untitled

a guest
May 16th, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication3
  7. {
  8. class Program
  9. {
  10. static void Main(string[] args)
  11. {
  12.  
  13. string buf;
  14. double startX = 0, endX = 9, dx = 1, r, y = 0, x;
  15. Console.WriteLine("Введите r:");
  16. buf = Console.ReadLine();
  17. r = double.Parse(buf);
  18.  
  19. Console.WriteLine("Введите x:");
  20. buf = Console.ReadLine();
  21. x = double.Parse(buf);
  22.  
  23. for (x = startX; x <= endX; x += dx)
  24. {
  25. if ((x >= (2 * r + 3)) && (x < r + 3))
  26. y = -(Math.Sqrt(r * r - Math.Pow(x + r + 3, 2)));
  27. if ((x >= r + 3) && (x < r))
  28. y = x - 3;
  29. if ((x >= r) && (x < 0))
  30. y = Math.Sqrt(r * r - x * x);
  31. if ((x >= 0) && (x < 3))
  32. y = x + 3;
  33. if ((x >= 3) && (x <= 9))
  34. y = 1 / 3 * x + 3;
  35.  
  36. Console.WriteLine("x = {0}, y = {1}", x, y);
  37.  
  38. }
  39.  
  40.  
  41. }
  42. }
  43. }
Add Comment
Please, Sign In to add comment