Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() //zad 7.
  6. {
  7. int dziala=1,i=0,x,tabl[100]={0},suma=0;
  8. while(dziala==1)
  9. {
  10. cout << "podaj liczbe: "<<endl;
  11. cin >> x;
  12. if (x>0)
  13. {
  14. tabl[i]=x;
  15. suma=suma+x;
  16. i++;
  17. }
  18. else
  19. {
  20. dziala=0;
  21. }
  22. }
  23. cout <<"wynik to: "<<suma<<endl;
  24. return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement