Untitled
unknown
plain_text
2 years ago
335 B
9
Indexable
#include <iostream>
using namespace std;
int main()
{
bool s = 0;
int n = 1;
int sum = 0;
int max = 0;
while (1){
cin >> n;
sum += n;
if (n == 0) {
if (s == 1) {
break;
}
else if (s == 0) s = 1;
}
else {
s = 0;
if (n > max) max = n;
}
}
cout << sum;
}Editor is loading...