Question: Write a program (the class name TwoConsecutive) that accepts three integer inputs and displays true if there is at least one pair of integers

Write a program (the class name TwoConsecutive) that accepts three integer inputs

Write a program (the class name TwoConsecutive) that accepts three integer inputs and displays true if there is at least one pair of integers that differ by exactly 1. For example, the integers 3 and 4 differ by 1. The integers 12 and 11 also differ by 1. Your program should display false if there are no such consecutive values. The integers could be input in any order; the two consecutive values could be any of the two values input. Here are some sample runs: Input Output 1, 2, 12 true 1, 12, 2 true 2, 12, 1 true 4, 5, 3 true 2, 4, 6 false 8, 8, 8 false

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 Programming Questions!