Prima problema:
#include <iostream>
using namespace std;
int main(){int n,p,q=1;cin >> n >> p;while(q<=p){cout << q << " ";q *= n;}return 0;}
A doua:
#include <iostream>using namespace std; int main(){int n, i, s = 0;cin >> n;for (i = 1; i <= n; i++){s = s + i * i;cout << s << " ";}return 0;}