C语言编程 自定义两个两位数的整数合并函数:

[复制链接]
查看11 | 回复2 | 2015-7-11 22:07:14 | 显示全部楼层 |阅读模式
#include int fun(int a,int b){ int c; c=(a/10)*1000+(b/10)*100+(a%10)*10+b%10; return c;}void main(){ int a,b; printf("请输入两个两位数:"); scanf("%d%d",&a,&b); printf("%d",fun(a,b));}我想问问题分不够了感觉行的话给点分谢谢
回复

使用道具 举报

千问 | 2015-7-11 22:07:14 | 显示全部楼层
这个挺简单的啊,int fun(int a,int b){ int x,y,z,k;//分别代表千位、百位、十位、个位 int c; x=a/10; z=a%10; k=b/10; y=b%10; c=x*1000+y*100+z*10+k; return c;}
回复

使用道具 举报

千问 | 2015-7-11 22:07:14 | 显示全部楼层
#includeint fun(int a,int b){ int c; c=a/10*1000+b%10*100+a%10*10+b/10; return c;}void main(){ int x,y,z; printf("Please input two integer(double-digit)!\n"); scanf("%d,%d",&x,&y); if(x100||y>100)printf("Error data!\n"); else { z=fun(x,y);printf("the data after conformitying is %d\n",z); }}
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行