fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int x, n = 0;
  6. cin >> x;
  7. while (x >= 0) {
  8. ++n;
  9. cin >> x;
  10. }
  11. cout << n;
  12. return 0;
  13. }
Success #stdin #stdout 0.01s 5276KB
stdin
1 2 0 -1
stdout
3