If I have to find a number in the range from 1 to 10^9 ,based on the given conditions,using loops and then stop,how to reduce the number of iterations of the loop in the best possible way? I have used the break statement when i get the required answer,what other than that can be used?

How do i get to the answer as fast as possible?

If the numbers are sorted, you can use binary_search which takes O(logN) time, instead of O(N).

what youâ€™re doing currently is linear search. you can try binary search for better results, covering higher range of numbers.