1
0
mirror of https://github.com/renbaoshuo/202401-programming-assignments.git synced 2024-12-16 15:44:39 +00:00
202401-programming-assignments/【实践课外】6.循环结构3/7-2 循环-十进制转化.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;
}