137k views
3 votes
An array named Ages holds 10 different ages. Write pseudo-code to increase each age in the array by one. The Ages array should be initialised as follows:

1 Answer

5 votes

Answer:

Ages = [12, 15, 20, 18, 25, 30, 40, 32, 28, 50]

for i = 0 to 9 do

Ages[i] = Ages[i] + 1

end for

Step-by-step explanation:

The above code initializes the Ages array with 10 different ages. The for loop iterates through the array, and for each element, it increases its value by 1. The loop starts at index 0 and goes up to index 9, which are the indices of the 10 elements in the array. After the loop completes, the Ages array will contain the original ages increased by 1.

User Shani Goriwal
by
7.8k points