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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!