Question: ( please only use if - if else - For - while - do while only ) ( c + + language ) Write a
please only use if if else Forwhile do while only
c language
Write a program that prompts the user to fill an array with positive integers.
If the user enters a negative value, the program should repeatedly request
a positive one. After the array is filled, the program should find and print
all pairs of elements in the array whose sum equals a specified number
provided by the user.
NOTE:
The array is of type integer and size
The program must ensure that the user only enters positive integers
into the array.
Sample Run
Fill array with numbers:
Invalid input! Please enter positive number:
Invalid input! Please enter positive number:
Enter a number to find pairs whose sum is equal to it:
mathrm and
and
mathrm and
Sample Run
Fill array with numbers:
Invalid input! Please enter positive number:
Enter a number to find pairs whose sum is equal to it:
and
and
and
and
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
