Programming Logic – You have written the following pseudocode to find the symmetric elements in an array…


You have written the following pseudocode to find the symmetric elements in an array.

get the input of array in an array named array
initialise another array and store the reverse of previous array in an array name rev_array
declare a counter variable
now run a loop from i = 0 to end of array
X
update counter
print this element
end loop

if counter == 0:
print no symmetric element found

You need to display any symmetric elements found and display an appropriate message if there are no symmetric elements found. However a part X in the pseudo code is missing. Analyze the snippet and determine the appropriate statement to be placed in X?

[Note: A symmetric element is an element that does not change its position even if the array is reversed]

Related Posts

Close Bitnami banner
Bitnami