#include <iostream>
using namespace std;
int main(){
int x, summa;
bool isZero = false;
cin >> x;
summa += x;
if(x == 0){
return 1;
}
else{
while (!isZero){
if (x == 0){
isZero = true;
cout << summa;
return 0;
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include <iostream>
using namespace std;
int main(){
int x, summa;
bool isZero = false;
cin >> x;
summa += x;
if(x == 0){
return 1;
}
else{
while (!isZero){
cin >> x;
if (x == 0){
isZero = true;
}
else{
summa += x;
}
}
cout << summa;
}
return 0;
}