Advertisement
Guest User

Zadacha3

a guest
Jun 26th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 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 Zadacha3
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. Console.WriteLine("Область D – заштрихованная часть плоскости\nФункция U определяется следующим образом: \nU = 0, если (x,y) принажлежит D\nU = x в противном случае\nТребуется найти U, если даны действительные числа x, y. \nD:\nx^2 + y^2 < 4\nx^2 + y^2 > 1\ny > 0");
  14. double x, y;
  15. double U;
  16. Console.WriteLine("Введите x");
  17. bool ok = true;
  18.  
  19. do
  20. {
  21. ok = double.TryParse(Console.ReadLine(), out x);
  22. if (!ok) Console.WriteLine("Ошибка, попробуйте еще раз");
  23. } while (!ok);
  24.  
  25. Console.WriteLine("Введите y");
  26. do
  27. {
  28. ok = double.TryParse(Console.ReadLine(), out y);
  29. if (!ok) Console.WriteLine("Ошибка, попробуйте еще раз");
  30. } while (!ok);
  31.  
  32. if (y >= 0 && x * x + y * y >= 1 && x * x + y * y <= 4)
  33. U = 0;
  34. else
  35. U = x;
  36. Console.WriteLine("U = " + U);
  37. }
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement