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