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

Write a program to print “hello world” without using semicolon?

669


The purpose of this exercise is to benchmark file writing and reading speed. This exercise is divided into two parts. a). Write a file character by character such that the total file size becomes approximately >10K. After writing close the file handler, open a new stream and read the file character by character. Record both times. Execute this exercise at least 4 times b). Create a buffer capable of storing 100 characters. Now after generating the characters, first store them in the buffer. Once the buffer is filled up, store all the elements in the file. Repeat the process until the total file size becomes approximately >10K.While reading read a while line, store it in buffer and once buffer gets filled up, display the whole buffer. Repeat the exercise at least 4 times with different size of buffer (50, 100, 150 …). Records the times. c). Do an analysis of the differences in times and submit it in class.

1626


What are the types of bitwise operator?

657


Explain what are binary trees?

606


How would you obtain the current time and difference between two times?

724






What is call by value in c?

555


which is an algorithm for sorting in a growing Lexicographic order

1394


What does d mean?

581


Describe explain how arrays can be passed to a user defined function

599


How can I display a percentage-done indication that updates itself in place, or show one of those twirling baton progress indicators?

574


Why should I prototype a function?

630


I have seen function declarations that look like this

598


What is the use of linkage in c language?

611


What does main () mean in c?

611


Why header file is used in c?

573