n=int(input("Enter the size of the array: "))
print("Enter ",n," number of elements of the array on the same line: ")
arr=[int(x) for x in input().split()]
print("Elements of the array before reverse: ")
for i in arr:
print(i,end=" ")
print("\nElements of the array after reverse: ")
arr2=arr[::-1]
for i in arr2:
print(i)
Comments
Leave a comment