Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var ans = Math.round(Math.random() * 100 + 1);
- var max = 100;
- var min = 1;
- while (true)
- {
- x = (max+min)/2;
- if(x == ans)
- {
- break;
- }
- else if( x > ans )
- {
- max = x ;
- }
- else if( x < ans )
- {
- min = x ;
- }
- }
- document.write("Result :" + x );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement