中易网

求2个整数中最大值的函数

答案:2  悬赏:70  
解决时间 2021-02-18 10:12
在主函数中输入2个整数,将最大值输出 编写这个c语言程序!!谢谢 在线等!!
最佳答案
#include "stdio.h"
int max(int,int);
main()
{
int a,b,y;
printf("请输入两个整数");
scanf("%d,%d",&a,&b);
y=max(a,b);
printf("最大值为%d",y);
}
int max(int x,int y)
{
if (x>y)
return x;
else
return y;
}
全部回答
#include using namespace std; int max(int a=0,int b=0,int c=0) {int max=a; if(b>max) max=b; if(c>max) max=c; return max; } int main() {int a,b,c; cout<<"请输入正整数三个:\n"; cin>>a>>b>>c; cout<<"三个数中的最大数为:"<
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯