Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#3.0 Homework NoEffort
in console application.
Thanks in advance
 
Regard
Sham
Posted 8-Nov-12 5:58am
Edited 8-Nov-12 8:21am
v2
Comments
shambhoo kumar at 8-Nov-12 11:59am
   
any one help me.it's very urgent......plz
joshrduncan2012 at 8-Nov-12 12:05pm
   
Why do you not want to use the sqrt function?
shambhoo kumar at 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 at 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
aspnet_regiis -i at 8-Nov-12 12:40pm
   
This is not the place to get your homework done
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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!
  Permalink  
Comments
Andreas Gieriet at 8-Nov-12 12:26pm
   
My 5!
I wonder how difficult it is to Google, e.g. Wikipedia...
Cheers
Andi
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

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]
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

#include
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");

}
  Permalink  
Comments
Shambhoo kumar at 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)



Advertise | Privacy | Mobile
Web02 | 2.8.140827.1 | Last Updated 1 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100