Techhgeekz ™

Thursday 8 August 2013

finding square root of a number by without using function sqrt

finding  square  root  of  a  number  by  without  using  function sqrt:-




void main()
{
float number;
float sqroot,temp;
clrscr();
printf("Enter a Number: ");
scanf("%f",&number);
sqroot=number/2;
temp=0;
while(sqroot!=temp)
{
temp=sqroot;
sqroot=(number/sqroot+sqroot)/2;
}
printf("Square root of %f is %f",number,sqroot);
getch();
}

<h1> finding square root of a number by without using function sqrt</h1>

No comments:

Post a Comment