using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
double a = 1.0, b = 0.0, x, y = 0.0;
do
{
x = (a + b) / 2;
if (x > 0) b = x;
else if (x < 0) a = x;
y = Math.Exp(x) - Math.Exp(-x) - 2;
if (x == a)
{
break;
}
}
while (Math.Abs(y) > 0.0001);
Console.WriteLine("x = {0:f2} и лежит в отрезке [0,1] | Ответ: y = {1:f4}", x, y);
Console.ReadKey();
}
}
}