The result can be displayed on the screen without using an array. Namely, iterate through successive numbers in a cycle, raise them to the desired degree and display the result immediately on the screen.
For exponentiation, the Math.Pow method is Math.Pow .
int n = 10; int power = 2; for (int i = 0; i < n; i++) { Console.Write(Math.Pow(i, power) + " "); }
If the resulting numbers are needed for something else, then it really makes sense to store them in an array:
int n = 10; int power = 2; double[] result = new double[n]; for (int i = 0; i < n; i++) { result[i] = Math.Pow(i, power); } Console.WriteLine(string.Join(" ", result));