Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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

Answers were Sorted based on User's Feedback



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

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

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

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

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

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

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

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

Post New Answer

More C Interview Questions

Why cann't whole array can be passed to function as value.

1 Answers  


Program will then find the largest of three numbers using nested if-else statements. User is prompted to enter three numbers. Program will find the largest number and display it on the screen. All three numbers entered by the user are also displayed. If user enters 21, 33, and 5, the output should be as follows: You entered: 21, 33 and 5. The largest number is 33.

0 Answers  


How can I get the current date or time of day in a c program?

0 Answers  


What is the function of ceil(X) defined in math.h do? A)It returns the value rounded down to the next lower integer B)it returns the value rounded up to the next higher integer C)the Next Higher Value D)the next lower value

3 Answers   Accenture, Wipro,


Explain the difference between malloc() and calloc() in c?

0 Answers  


WAP to accept rollno,course name & marks of a student & display grade if total marks is above 200?

4 Answers  


What is the use of ?: Operator?

0 Answers  


Why ordinary variable store only one value  

0 Answers  


Which weighs more, a gram of feathers or a gram of gold?

2 Answers  


What is the difference between typeof(foo) and myFoo.GetType()?

2 Answers   Synergy,


Explain the difference between struct and union.

2 Answers  


What is Memory leakage ?

2 Answers   HCL,


Categories