Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int sumuj(int suma,int liczba){
- suma=0;
- while(liczba>0)
- {
- cout<<"podaj liczbe"<<endl;
- cin>>liczba;
- if(liczba<=0){
- cout<<"koniec dodawania"<<endl;
- break;
- }
- else{
- suma=suma+liczba;
- cout<<"wyswietl "<<suma<<endl;
- }
- }
- return suma;
- }
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- int main(int argc, char** argv) {
- int suma, liczba;
- cout<<"Podales zla wartosc, suma wynosi: "<<sumuj(suma,liczba)<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment