赞
踩
例如,当a=45,b=12,调用该函数后c=2415。
#include<stdio.h>
#include<string.h>
int fun(int a, int b)
{
int i, j, c;
int d[2], e[2];
for (i = 0; i < 2; i++)
{
d[i] = a % 10;
a = a / 10;
}
for (j = 0; j < 2; j++)
{
e[j] = b % 10;
b = b / 10;
}
c = e[0] * 1000 + d[1] * 100 + e[1] * 10 + d[0];
return c;
}
int main()
{
int a, b, c;
printf("请输入俩个数字:");
scanf("%d%d", &a, &b);
c = fun(a, b);
printf("%d", c);
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。