Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
219 B
3
Indexable
Never
#include <iostream>
using namespace std;

int main()
{
    int n, c=0;
    cin >> n;

    do {
        int digit = n % 10;
        n /= 10;
        c += digit;
    } while (n > 0);
    cout << c << endl;
}