Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Zadacha3
- {
- class Program
- {
- static void Main(string[] args)
- {
- 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");
- double x, y;
- double U;
- Console.WriteLine("Введите x");
- bool ok = true;
- do
- {
- ok = double.TryParse(Console.ReadLine(), out x);
- if (!ok) Console.WriteLine("Ошибка, попробуйте еще раз");
- } while (!ok);
- Console.WriteLine("Введите y");
- do
- {
- ok = double.TryParse(Console.ReadLine(), out y);
- if (!ok) Console.WriteLine("Ошибка, попробуйте еще раз");
- } while (!ok);
- if (y >= 0 && x * x + y * y >= 1 && x * x + y * y <= 4)
- U = 0;
- else
- U = x;
- Console.WriteLine("U = " + U);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement