Code for calculating
square root without
using library function,
of math.h
Answer Posted / manikant
#include<iostream.h>
void main()
{
int num,i;
cout<<"enter anumber:";
cin>>num;
for(i=2;i<num/2;i++)
{
if(num/i==i)
{
cout<<"\nsquareroot of "<<num<<"="<<i;
break;
}
else
continue;
}
if(num/i!=i)
cout<<"\nthis no is not a perfect square.";
}
| Is This Answer Correct ? | 16 Yes | 13 No |
Post New Answer View All Answers
What does typeof return in c?
What is variable initialization and why is it important?
What is function and its example?
What are the three constants used in c?
Why does this code crash?
What is the purpose of ftell?
What is Dynamic memory allocation in C? Name the dynamic allocation functions.
What math functions are available for integers? For floating point?
How can I determine whether a machines byte order is big-endian or little-endian?
What are the different types of control structures in programming?
What is the difference between local variable and global variable in c?
Explain what does the format %10.2 mean when included in a printf statement?
Explain how can I remove the trailing spaces from a string?
How does placing some code lines between the comment symbol help in debugging the code?
What is echo in c programming?