这是一个很好玩的小游戏,输入两个两位数的正整数a、b,合并形成一个整数放在c中。合并的方式是:将a数的十位和个位数依次放在c数的百位和个位上,b数的十位和个位数依次放在c数的十位和千位上。 提示 将数字按个位和十位分解。
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b,c,d,e,f,g;
scanf("%d %d",&a,&b);
if(a<100&&a>0&&b<100&&b>0)
{
d=a/10,e=b%10,f=a%10,g=b/10;
c=100*d+e*1000+f+g*10;
printf("%d\n",c);
}
return 0;
}