有戏

 找回密码
 立即注册
简历下载
搜索
热搜: 活动 交友 discuz
查看: 836|回复: 0

用数组求最大值

[复制链接]

1000

主题

1002

帖子

25万

积分

论坛元老

Rank: 8Rank: 8

积分
251951
发表于 2015-1-17 18:28:46 | 显示全部楼层 |阅读模式
#include <stdio.h>
#include <conio.h>
#include <math.h>

int main()
{
   // int a1=1,a2=1,a3;
  //  int n=20;
    int a[5] = {6,8,77,21,66};
    int max = a[0];
    int i;
    for(i=1;i<5;i++)
    {
        if(a[i] > max)
            max = a[i];
    }
    printf("max = %d\n",max);
    return 0;
}

大家好
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|有戏 粤ICP备2020111303号

GMT+8, 2025-12-6 14:49 , Processed in 0.072818 second(s), 19 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表