C++ (Qt)#include <iostream> using namespace std; int main(int argc, char ** argv) { int n; cin >> n; int a; int sum = 0; while (n--) { cin >> a; sum += a; } cout << "\nsum=" << sum << endl; return 0;}