编程将两个2位的正整数a、b合并成一个4位正整数c,合并的方式是:将a数的十位和个位依次放在c数的千位和十位上, b数的十位和个位依次放在c数的百位和个位上(例如:当a=38,b=27时,输出结果c=3287)。

#include <stdio.h>
void main()
{
int a,b;
int x,y,z,m;
printf("input the first number:");
scanf("%d",&a);
printf("input the second number:");
scanf("%d",&b);
x=a/10;
y=b/10;
z=a-a/10*10;
m=b-b/10*10;
printf("%d%d%d%d",x,y,z,m);
}

猜你喜欢

转载自www.cnblogs.com/bobotongxue/p/12290631.html