fork download
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int sumar=0,numeros;
  6. do
  7. {
  8. cin>>numeros;
  9.  
  10. if(numeros>0)
  11. {
  12. sumar=sumar+numeros;
  13. }
  14. }
  15. while(numeros!=0);
  16. cout <<sumar<<endl;
  17. return 0;
  18. }
Success #stdin #stdout 0.01s 5292KB
stdin
12 1 7 0
stdout
20