Difference between revisions of "CSC111 Final Exam 2018"
Line 217: | Line 217: | ||
=Problem 4= | =Problem 4= | ||
<br /> | <br /> | ||
− | Dave, here's a bunch of banana. Can you tell me if there are two bananas next to each other that have the same weight? | + | '''Dave, here's a bunch of banana. Can you tell me if there are two bananas next to each other that have the same weight?''' |
<br /> | <br /> | ||
− | |||
<br /> | <br /> | ||
− | Your program must use a recursive function to determine if the there exist two consecutive numbers that have the same value. | + | Write a program containing a recursive function, that prompts the user for a list of integers, and prints out "True" if there are two numbers in the list that are consecutive and have the same value, and it prints "False" otherwise. |
+ | <br /> | ||
+ | Your program must use a recursive function to determine if the there exist two consecutive numbers that have the same value. Programs that do not contain a recursive solution will get 0/100. | ||
<br /> | <br /> | ||
Examples of interactions with the program: | Examples of interactions with the program: |