but when I run it the calculations aren't even performed
yes they are performed but you can't see the results since you don't print the variable you saved the value to after the calculation.
also remember that when you return a value from the method it returns the control to the calling method making your loop useless. Instead I suggest you use a loop at main
zeroliken
Nearly a Posting Virtuoso
1,346 posts since Nov 2011
Reputation Points: 214
Solved Threads: 205
Skill Endorsements: 14
Look at the position of {}s in the parameter() method. Some are missing that will effect how the code executes.
Indenting code does not make it be included within an if or else statement.
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
Your loop is interating only once.If you write return statement after while loop in your program then it will be an infinite loop.Better make the function "parameter" recursive.
amrita111
Junior Poster in Training
59 posts since Aug 2010
Reputation Points: 14
Solved Threads: 6
Skill Endorsements: 1
I obeserve that the code does not find the number under guess.
if user is trying to use binary search for finding the number under guess then this is not the correct implementation of binary search.
I dont even find even if recursion is being used here.
In any case the while loop will iterate only once.
I dont know how the value being printed is related to number under guess.
I dont even see the guessed number is stored some where in the program to be compared later in the program.
subramanya.vl
Junior Poster in Training
81 posts since Oct 2012
Reputation Points: 0
Solved Threads: 10
Skill Endorsements: 1