请编写函数fun,其功能是:将两个两位数的正整数a,b合并成一个整数放在c中。 合并的方式是:将a数的十位和个位依次放在c数的千位和十位上,b数的十位和个位数依次放在c数的百位和个位上

/请编写函数fun,其功能是:将两个两位数的正整数a,b合并成一个整数放在c中。
合并的方式是:将a数的十位和个位依次放在c数的千位和十位上,b数的十位和个位数依次放在c数的百位和个位上
/

#include <stdio.h>
#include <string.h>
int fun(int a,int b)
{
    int sum=(a%10)*10+(b%10)+(a/10)*1000+(b/10)*100;
    return sum;
}
int main(void)
{
    int a,b,c;
    printf("please enter two two-digit integer\n");
    scanf("%d %d",&a,&b);
    c=fun(a,b);
    printf("%d\n",c);
    return 0;
}

posted on 2024-06-27 22:59  wessf  阅读(42)  评论(0)    收藏  举报