#include <iostream>
using namespace std;
int main() {
int n;
cout << "Enter a number: ";
cin >> n;
// Create an array of size n
int squares[n];
// Fill the array with squares
for (int i = 1; i <= n; i++) {
squares[i-1] = i * i;
}
// Print the array elements
cout << "Squares of numbers till " << n << " are: ";
for (int i = 0; i < n; i++) {
cout << squares[i] << " ";
}
cout << endl;
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: