#include <iostream> using namespace std; int main() { int count; cout << "Сколько чисел вы хотите суммировать" << endl; cin >> count; cout << "Вводите " << count << " чисел: " << endl; int interations = 0; int sum = 0; while(interations < count){ int number; cin >> number; sum += number; interations += 1; } cout << "Сумма равна" << sum; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter