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 Z_3
- {
- class Program
- {
- static void Main(string[] args)
- {
- int q = 1;
- while (q == 1)
- {
- Console.Write("введите начало диапазона. a= ");
- double a = double.Parse(Console.ReadLine());
- Console.Write("введите конец диапазона. b= ");
- double b = double.Parse(Console.ReadLine());
- Console.Write("введите размер шага. h= ");
- double h = double.Parse(Console.ReadLine());
- for (double i = a; i <= b; i = i + h)
- {
- myfunction(i);
- }
- Console.Write("если хотите продолжить введите 1 : ");
- q = int.Parse(Console.ReadLine());
- }
- }
- public static void myfunction(double x)
- {
- if (x < 0)
- {
- Console.WriteLine("При x={0}, y=-4", x);
- }
- else
- {
- if (x < 1)
- {
- double y = Math.Pow(x, 2) + 3 * x + 4;
- Console.WriteLine("При x={0}, y={1}", x, y);
- }
- else
- {
- Console.WriteLine("При x={0}, y=2", x);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement