编写一个C语言程序,其功能是b

将两个两位数的正整数放在C中,合并的方式是:将A数的十位和个位数依次放在C数的百位和个位上,将B数的十位和个位数依次放在C数的十位和千位数上.
例如:当A=45,B=12,最后得到的结果是:C=2415
main()
{int a,b,c,temp;
printf("input the 'a'汪迅肆 and 'b':\n");
scanf("%d,%d",&a,&b);
if(a>昌如=100||b>=100)
scanf("%d,%d",&a,&b);
temp=b%10*1000;/* 计算C的千位 */
c=temp;
temp=a/10*100; /* 计算C的百位 */
c+=temp;
temp=b/10*10; /* 计算C的十位 */
c+=temp;
temp=a%10; /* 计算C的个位困轿 */
c+=temp;
printf(\n the c is :\n);
printf("%d",c);
}
#include
int main()
{
int a=12;
int b=34;
int c;
c=a%10+a/档袜10*100+b%10*1000+b/宴蠢拍10*10;
printf("%d"晌羡,c);
return 0;
}
# include
void main()

{
int a,b;
printf("输入数销塌a,b:\n");
scanf("%d,%d",&a,&b);
{ if(a<100&&b<100)
{ printf("输入的两个数字是%d,%d\n",a,b);

int c,d,e,f,g;
d=a/10;//a的10位
e=a-d*10;//a的个位
f=b/10;//b的10位
g=b-f*10;//b的个位
c=g*1000+d*100+f*10+e;
printf("最后组成的数字是:%d\n",c);
}
else
printf("error\n");}//判断两个数字输入的情宏中况,
//解决亏绝圆错误情况
}
编写一个C语言程序,其功能是b
← 上一篇: 下一篇: →