mirror of
https://github.com/renbaoshuo/202401-programming-assignments.git
synced 2024-11-27 08:26:20 +00:00
20 lines
251 B
C
20 lines
251 B
C
#include <stdio.h>
|
|
|
|
int main() {
|
|
int n, m;
|
|
|
|
scanf("%d%d", &n, &m);
|
|
|
|
int result = 0, factor = 1;
|
|
|
|
while (n) {
|
|
result += (n % m) * factor;
|
|
n /= m;
|
|
factor *= 10;
|
|
}
|
|
|
|
printf("%d\n", result);
|
|
|
|
return 0;
|
|
}
|