码迷,mamicode.com
首页 > 其他好文 > 详细

摸索第一篇

时间:2020-02-15 13:15:26      阅读:52      评论:0      收藏:0      [点我收藏+]

标签:int   scanf   can   else   个数   return   include   lse   ret   

用函数找较大的值:
 
//用函数输出两个数中较大的数
#include<stdio.h>
int max(int a,int b);
int main(){
 int a,b;
 scanf("%d %d",&a,&b);
 
 printf("较大的那个数是%d",max(a,b));
 return 0;
}
int max(int a,int b){
 if(a>b){
  return a;
 }
 else return b;
}
 
 
直接把比较的数放在函数里面比较

摸索第一篇

标签:int   scanf   can   else   个数   return   include   lse   ret   

原文地址:https://www.cnblogs.com/12345-one/p/12273953.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!