Ответ учителя по предмету Информатика
#include <iostream>
#include <stdlib.h>
using namespace std;
int count_digits(int a) {
int s;
for(a = abs(a), s = 0; a > 0; s+=a%10, a/=10);
return s;
}
int main() {
int a;
cin >> a;
cout << count_digits(a) << endl;
}
Похожие вопросы от пользователей
1. Pay attention__the teacher`s instructions
2. Why do you always in gist__sitting here?
3. Jane recovered__her illnessvery quickly.