#include?stdio.h

成都創(chuàng)新互聯(lián)專注于企業(yè)全網(wǎng)整合營銷推廣、網(wǎng)站重做改版、通遼網(wǎng)站定制設(shè)計、自適應品牌網(wǎng)站建設(shè)、html5、成都做商城網(wǎng)站、集團公司官網(wǎng)建設(shè)、外貿(mào)網(wǎng)站制作、高端網(wǎng)站制作、響應式網(wǎng)頁設(shè)計等建站業(yè)務(wù),價格優(yōu)惠性價比高,為通遼等各大城市提供網(wǎng)站開發(fā)制作服務(wù)。
int?fun(int?a,int?b)
{
return?(a??b???a?:?b);
}
int?main()
{
int?a,b;
printf("Input?a?b:?");
scanf("%d?%d",a,b);
printf("max?=?%d",fun(a,b));
return?0;
}
#include stdio.h
#include stdlib.h
int main()
{
int n,a,max,i;
scanf("%d",n);
scanf("%d",max);
for(i=1;in;i++)
{
scanf("%d",a);
if(amax)max=a;
}
printf("%d",max);
return 0;
}
自定義函數(shù)實現(xiàn)
int max(int a,int b)
{
return ab?a:b;
}
#include stdio.h
void f(int *x, int *y)
{
int t;
t = *x;
*x = *y;
*y = t;
}
int main(void)
{
int a[3];
int i, j;
int x, y, z;
while(scanf("%d%d%d", x, y, z)!=EOF)
{
a[0] = x;
a[1] = y;
a[2] = z;
for(i=1;i3;i++)
for(j=0;j3-i;j++)
if(a[j]a[j+1])
f(a[j], a[j+1]);
printf("%d %d %d\n", a[0], a[1], a[2]);
}
return 0;
}
三個數(shù)從大到小,不知道你說的是不是這個意思,想要n個數(shù)的話,改下就可以了,其實一般都用快排的,方便
#includestdio.h
int getmax_i(int a[], int size){
int max_i=0, i;
for(i=1; isize; i++)
if(a[max_i]a[i]) max_i=i;
return max_i;
}
main(){
int a[5],i;
for(i=0; i5; i++)
scanf("%d",a[i]);
i=getmax_i(a, 5);
printf("最大值%d,下標%d\n", a[i], i);
}
#include double Max(double a,double b,double c);double Avg(double a,double b,double c);int main() { double a,b,c; printf("輸入三個數(shù),空格隔開:"); scanf("%lf%lf%lf",a,b,c); printf("最大值比平均值大%lf\n",Max(a,b,c) - Avg(a,b,c)); return 0;}double Max(double a,double b,double c) { double max = a; if(max b) max = b; if(max c) max = c; return max;}double Avg(double a,double b,double c) { return (a + b + c)/3.0;}
本文名稱:c語言中調(diào)用最大值的函數(shù),c語言最大值函數(shù)怎么使用
標題路徑:http://chinadenli.net/article42/dsghoec.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供電子商務(wù)、網(wǎng)站營銷、做網(wǎng)站、手機網(wǎng)站建設(shè)、企業(yè)建站、小程序開發(fā)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)