What is wrong with my code? When I enter '9', I get '3.4' as the output which is wrong. It should display '3'.Code:#include<stdio.h>
float SR(float s)
{
float a, b, c;
a = 1;
b = (a + s / a)/2;
c = b - a;
a = b;
while(c*c>0.001){
b = (a + s / a)/2;
return b;}
return b;
}
int main()
{
float x;
printf("Please enter a number: ");
scanf("%f", &x);
printf("The square root of %f is %f", x, SR(x));
scanf("%d");
}