1
0
mirror of https://github.com/renbaoshuo/202401-programming-assignments.git synced 2024-11-23 21:58:41 +00:00
202401-programming-assignments/【实践课外】6.循环结构3/7-2 循环-十进制转化.c

20 lines
251 B
C
Raw Normal View History

2024-11-02 12:58:43 +00:00
#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;
}