Nayyab F.

asked • 05/27/21

it is the question regarding c++ programming and i am not able to solve it and i hope you will give me best solution

Take an unsorted array of size 15 and type int from the user and a number n, find if there exists a

pair of elements in the array whose difference is n.

Examples:

Input: arr[] = {5, 20, 3, 2, 50, 80}, n = 78

Output: Pair Found: (2, 80)

Input: arr[] = {90, 70, 20, 80, 50}, n = 45

Output: No Such Pair

2 Answers By Expert Tutors

By:

Patrick B. answered • 05/27/21

Tutor
4.7 (31)

Math and computer tutor/teacher

Scott P. answered • 05/27/21

Tutor
5.0 (130)

Experienced, patient computer/computer science tutor

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.