The program searches for the number k, the only problem is that you cant enter in a list of numbers that n long. The way it's written, it's limited to 5 inputs. That can be changed to however many is desired, but it's still locked into that that many. I'm not sure how to make it so that can happen.
However, as the program is written, it is successful. You can enter in any number into the a1 - a5 locations, and then it asks for a k. It then searches a1-a5 for k and returns what location it is in if it's there, otherwise returns that the number is not here. It will also finish in finite time.
No comments:
Post a Comment