Question: Write a program that examines a series of a integers entered by the user and that then determines whether adjacent values in the series differ
Write a program that examines a series of a integers entered by the user and that then determines whether adjacent values in the series differ by at most 2.
The program should ask the user to enter the number , n, of numbers in the sequence, followed by the numbers themselves (i.e. one per line). The assumption is that n>1.
Hint: The function abs(-5) will return 5.
Sample Input/Output:
Enter the length of the sequence:
3
Enter the number 1:
50
Enter the number 2:
51
Within bounds
Sample Input/Output:
Enter the length of the sequence:
3
Enter the number 1:
50
Enter the number 2:
51
Enter the number 3:
57
Not within bounds
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
