#include <stdio.h>
int main()
{
int a,b,m,i=0;
long int x;
char c[70] = {0};
scanf("%d %d %d",&a, &b, &m);
x = a+b;
if(x<m) printf("%d",x); //只输出一位数
else{ //多位数
while( 1 )
{
c[i] = (x%m)+'0'; i++;
if( (x/m) >= m ) x = x/m;
else {c[i] = (x/m)+'0'; break;}
}
while(i+1)
{
printf("%c",c[i]);
i--;
}
}
return 0;
}
1022 D进制的A+B,C
猜你喜欢
转载自blog.csdn.net/weixin_43916400/article/details/104403185
今日推荐
周排行