Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- long long SumOfProduct(long long n)
- {
- long long r, q = n, s = 0;
- while(q > 0) {
- r = q % 10;
- s += r;
- q /= 10;
- }
- return s;
- }
- int main()
- {
- long long x; // as x <= 10^19
- scanf("%lld", &x);
- long long sum;
- sum = SumOfProduct(x);
- printf("%lld\n", sum);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement