Click here to Skip to main content
15,881,092 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
in console application.
Thanks in advance

Regard
Sham
Posted
Updated 8-Nov-12 8:21am
v2
Comments
Shambhoo kumar 8-Nov-12 11:59am    
any one help me.it's very urgent......plz
joshrduncan2012 8-Nov-12 12:05pm    
Why do you not want to use the sqrt function?
Shambhoo kumar 8-Nov-12 12:12pm    
because just i want to check ur programming skill....ok..:(
it's my interview question and i do not know how i solve it so i ask to every one..:)
Andreas Gieriet 8-Nov-12 12:38pm    
What is your background? What math do you know, e.g. logarithms? What algorithms do you know, e.g. binary search? What computer arithmetics do you know, e.g. CORDIC?
Plenty of areas to check out... :-)
Cheers
Andi
bbirajdar 8-Nov-12 12:40pm    
This is not the place to get your homework done

There are a number of ways to do it, and Google will help you find the algorithms.

But we do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action. So, I won't be pointing you at them.

Try it yourself, you may find it is not as difficult as you think!
 
Share this answer
 
Comments
Andreas Gieriet 8-Nov-12 12:26pm    
My 5!
I wonder how difficult it is to Google, e.g. Wikipedia...
Cheers
Andi
This looks like a test of thinking about a problem more than coding it.
The OP question appears to be: Is a given number R the square root of another given number X.
Taking the square root of X is "forbidden".
[Hint]
...but multiplication, and checking for equality (within a tolerance) is allowed.
[/Hint]
 
Share this answer
 
v2
#include<stdio.h>
main()
{

int a,b,c,d;
printf("Enter:");
scanf("%d",&b);
for(a=1;a<=b;a++)
{
if((a*a)==b)
{c=2;break;}

}
if(c==2)
printf("Yes");
else
printf("No");

printf("\n");

}
 
Share this answer
 
Comments
Shambhoo kumar 10-Feb-13 6:13am    
Thanks dear..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900