Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

7.13 Write a loop that reads ten numbers and a second loop that displays them in

ID: 3556136 • Letter: 7

Question

7.13 Write a loop that reads ten numbers and a second loop that displays them in the opposite order from which they were entered.

7.14 For the operations on partially filled arrays below, provide the header of a method. Do not implement the methods.

a.?Sort the elements in decreasing order.

b.?Print all elements, separated by a given string. c.?Count how many elements are less than a given value.

d.?Remove all elements that are less than a given value.

e.?Place all elements that are less than a given value in another array.

Explanation / Answer

1) int i, A[10];

for(i=0;i<10;i++){ cin>>A[i];}

for(i=0;i<10;i++){ cout<<A[9-i];}

2) a) we can find the max and place it at the front till it fills the last element

b) int given_value,count;

if(A[0] < given_value){count++;} cout<<A[0];

for(i=1;i<10;i++){ if(A[0] < given_value){count++;}

cout<<s; cout<<A[i] ; }

d) the element we have to remove we keep a empty value

for(i=0;i<10;i++){if(A[i] < given_value)(A[i] = NULL;)}

now move all the the nulls to the last

e) int j=0, B[10];

for(i=0;i<10;i++){if(A[i] < given_value)(B[j] = A[i]; j++;)}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote