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;
- namespace ConsoleApplication3
- {
- class Program
- {
- static void Main(string[] args)
- {
- string buf;
- double startX = 0, endX = 9, dx = 1, r, y = 0, x;
- Console.WriteLine("Введите r:");
- buf = Console.ReadLine();
- r = double.Parse(buf);
- Console.WriteLine("Введите x:");
- buf = Console.ReadLine();
- x = double.Parse(buf);
- for (x = startX; x <= endX; x += dx)
- {
- if ((x >= (2 * r + 3)) && (x < r + 3))
- y = -(Math.Sqrt(r * r - Math.Pow(x + r + 3, 2)));
- if ((x >= r + 3) && (x < r))
- y = x - 3;
- if ((x >= r) && (x < 0))
- y = Math.Sqrt(r * r - x * x);
- if ((x >= 0) && (x < 3))
- y = x + 3;
- if ((x >= 3) && (x <= 9))
- y = 1 / 3 * x + 3;
- Console.WriteLine("x = {0}, y = {1}", x, y);
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment