Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdint.h>
- #include <inttypes.h>
- int main() {
- int64_t n;
- int power;
- int sum = 0;
- scanf("%" SCNd64 "%d", &n, &power);
- while (n != 0) {
- sum += n % power;
- n /= power;
- }
- printf("%d\n", sum);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement