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();
}
finding square root of a number by without using function sqrt
No comments:
Post a Comment