Kod na sumę cyfr jest prosty.
#include<iostream>
using namespace std;
int main()
{
long long int x, suma = 0;
cin >> x;
while (x > 0)
{
suma += x%10;
x /= 10;
}
cout << suma << endl;
return 0;
}
co zrobić jak namy 1<= x <= 10^100 ?