Challenge: Array of Squares

Test yourself and implement what you have learned so far in this challenge.

Problem Statement

You are given an Array of integers. The Array needs to be modified in such a way that it should contain the squares of the original values at the same index as the original values.

For instance, if the element at index 0 is 5, after modification it should be 25.


The input will be the array testArray which stores the array to be modified.

testArray has already been declared for you.


The output will be the modified testArray.

Sample Input


Sample Output


Test Yourself

Write your code in the given area. Try the exercise by yourself first, but if you get stuck, the solution has been provided. Good luck!

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy