D - Сумма цифр числа
unknown
c_cpp
2 years ago
149 B
13
Indexable
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
cout << n % 10 + n / 10 % 10 + n / 100;
return 0;
}Editor is loading...
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
cout << n % 10 + n / 10 % 10 + n / 100;
return 0;
}