Code for calculating
square root without
using library function,
of math.h

Answer Posted / sarath

#include<stdio.h>
#include<conio.h>

void main()
{
float i,num;
printf( "Enter number : ");
scanf("%f",&num);
for(i=2.0;i<num/2;i++)
{
if(num/i==i)
{
printf(" \nSquare root of %.0f = %.0f",num,i);
break;
}
else
continue;
}

if(num/i!=i)
printf("\nThere is no perfect integer square root for the number %.0f",num);
getch();
}

Is This Answer Correct ?    34 Yes 17 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What math functions are available for integers? For floating point?

896


how should functions be apportioned among source files?

887


What are volatile variables in c?

727


Explain threaded binary trees?

938


Write a code to achieve inter processor communication (mutual exclusion implementation pseudo code)?

936


can any one provide me the notes of data structure for ignou cs-62 paper

1934


What is the advantage of a random access file?

899


What is getch?

863


Is c a great language, or what?

893


What does c mean before a date?

876


What is optimization in c?

774


What is a method in c?

849


Hi can anyone tell what is a start up code?

1859


Is it valid to address one element beyond the end of an array?

954


Explain what does it mean when a pointer is used in an if statement?

858