c语言大佬帮帮我!这个编程怎么写,求详细过程,谢谢!

如题所述

思路是这样的,m为结果的高位,n为结果的低位,如果n共有x位,则结果为高位乘10的x次方加低位,写成代码为:
#include<stdio.h>
#include<math.h>
int main(){
int m,n,result;
scanf("%d%d",&m,&n);
//计算n的位数 count
int x = n;
int count=0;
while(x !=0){
x /= 10;
count++;
}
//结果=m*10的count次方+n
result = m * pow(10,count) + n;
printf("%d",result);
}
温馨提示:答案为网友推荐,仅供参考
第1个回答  2019-10-14
#include<stdio.h>
#include<math.h>
int main()
{
int m, n, tmp, count = 1, mn;
scanf("%d %d", &m, &n);
tmp = n;
while (tmp >= 10)
{
count++;
tmp /= 10;

}
mn = (int)pow(10, count)*m + n;
printf("%d", mn);

return 0;

}
相似回答