Code for calculating
square root without
using library function,
of math.h
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / 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 |
Answer / abhinav dwivedi
#include<stdio.h>
#include<conio.h>
void main()
{
int num,i;
clrscr();
printf("enter no to find square root");
scanf("%d",&num);
for(i=1;i<=num/2;i++)
{
if(num/i==i && num%i==0)
{
printf("square root of entered no is %d",i);
break;
}
else
{
continue;
}
}
if(num/i!=i)
printf("their is no perfect suare root of entered no");
}
| Is This Answer Correct ? | 10 Yes | 9 No |
Answer / darshana
Dim i As Integer
Console.WriteLine("enter the number")
i = Console.ReadLine()
For a As Integer = 0 To 1000
If a * a = i Then
Console.WriteLine(a)
Exit Sub
End If
Next
| Is This Answer Correct ? | 5 Yes | 14 No |
a<<1 is equivalent to a) multiplying by 2 b) dividing by 2 c) adding 2 d)none of the above
/*what is the output for the code*/ void main() { int r; r=printf("naveen"); r=printf(); printf("%d",r); getch(); }
hat is a pointer?
provide an example of the Group by clause, when would you use this clause
Design a program using an array that searches a number if it is found on the list of the given input numbers and locate its exact location in the list.
the maximum width of a c variable name can be a) 6 characters b) 8 characters c) 10 characters d) 20 characters
Predict the output or error(s) for the following: 25. main() { printf("%p",main); }
What is the full form of getch?
What is #line?
What is 2 d array in c?
What is storage class?
hi send me sample aptitude papers of cts?