NS
Natalia Smodleva
#include
using namespace std;
int main() {
int x;
cin >> x;
int s = 0;
do {
s += x % 10;
x /= 10;
} while (x != 0);
cout << s << endl;
return 0;
}
#include
using namespace std;
int main() {
int x;
cin >> x;
int s = 0;
while (x != 0) {
s += x % 10;
x /= 10;
};
cout << s << endl;
return 0;
}
#include
using namespace std;
int main() {
int x;
cin >> x;
int s;
for (s = 0; x != 0; x /= 10) {
s += x % 10;
}
cout << s << endl;
return 0;
}