Guest User

Untitled

a guest
Jan 13th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int sumuj(int suma,int liczba){
  4. suma=0;
  5. while(liczba>0)
  6. {
  7. cout<<"podaj liczbe"<<endl;
  8. cin>>liczba;
  9. if(liczba<=0){
  10. cout<<"koniec dodawania"<<endl;
  11. break;
  12. }
  13. else{
  14. suma=suma+liczba;
  15. cout<<"wyswietl "<<suma<<endl;
  16. }
  17. }
  18. return suma;
  19. }
  20. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  21. int main(int argc, char** argv) {
  22. int suma, liczba;
  23. cout<<"Podales zla wartosc, suma wynosi: "<<sumuj(suma,liczba)<<endl;
  24. return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment