using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks; namespace 牛顿法计算根号下2的值
{
class Program
{
static void Main(string[] args)
{
double a = , b = , t = ;
while (b - a > 0.0000001)
{
t = (a + b) / ;
if (t * t - == )
{
Console.WriteLine(t);
break;
}
else if ((t * t - ) > )
{
b = t;
Console.WriteLine(t * t - );
}
else
{
a = t;
Console.WriteLine(t * t - );
}
}
Console.WriteLine("sqt(2)={0}",t);
}
}
}
http://www.51taoshi.com/ucenter/pub/diaryShow.action?did=140525134206646418