Untitled
unknown
c_cpp
2 years ago
506 B
5
Indexable
#include <iostream>
using namespace std;
int main()
{
bool secondZero = false; // 0
int max = -1;
int tmp;
bool konec = false;
while (!konec) {
cin >> tmp;
if (tmp == 0) {
if (secondZero == true) {
konec = true;
}
else if (secondZero == false) secondZero = true;
}
else {
secondZero = false;
if (tmp > max) max = tmp;
}
}
cout << max;
}Editor is loading...