Advertisement
Nikitka_36

ChisMeth

Feb 27th, 2015
477
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.66 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication1
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             double a = 1.0;
  13.             double b = 6.0;
  14.             double eps = 10e-6;
  15.             double m;
  16.             double x;
  17.  
  18.             if (Math.Log(a) == 0)
  19.                 x = a;
  20.             if (Math.Log(b) == 0)
  21.             while (Math.Abs(a - b) > 2 * eps)
  22.             {
  23.                 m = (a + b) / 2;
  24.                 if (Math.Log(a)*Math.Log(m)>0)
  25.                     a = m;
  26.            
  27.             }return (a+b)/2;
  28.  
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement