Question: Write a C++ program that prompts the user to enter 15 integers and stores them in an array. The program then determines and outputs

Write a C++ program that prompts the user to enter 15 integers  

Write a C++ program that prompts the user to enter 15 integers and stores them in an array. The program then determines and outputs which numbers in the array are sum of two other array elements. If an array element is the sum of two other array elements, then for this array element, the program should output all such pairs. Hint: You have to use 3 (for) loops (i, j, and k) to go through all the elements in the array. Then you have to check if the item at index i (i starts from 0) equals the sum of the items at index j (j starts from 0) and k (k starts from j + 1), then print out the index of these two items. Sample of run: Input: 10 17 23 65 34 6 18 27 35 110 75 25 100 24 19 Output: list [0] = 10 is the sum of: list [1] 17 is the sum of: list [2] 23 is the sum of: list [1], list [5]; list [3] = 65 is the sum of: list [4] 34 is the sum of: list [0], list [13]; Activate Wi Go to Settings t

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!