Răspuns:
#include <iostream>
using namespace std;
int main()
{
int a, n, sum = 0;
cout << "a = "; cin >> a;
for(int i=1; i<=10; ++i)
cout << a << " x " << i << " = " << a * i << endl;
cout << endl << "n = "; cin >> n;
for(int i=1; i<=n; ++i)
sum += i;
//sau direct -> sum = n*(n+1)/2;
cout << "S = " << sum;
return 0;
}