写出c程序:输入20个整数,求3个最大值和3个最小值,输出结果

[复制链接]
查看11 | 回复1 | 2011-4-14 09:26:06 | 显示全部楼层 |阅读模式
回复

使用道具 举报

千问 | 2011-4-14 09:26:06 | 显示全部楼层
<pre id=\"best-answer-content\" class=\"reply-text mb10\">#include stdio.h

void main()
{
int a[20];

int i,j,t;

printf(\"输入20个数\\n\");
for(i=0;i20;i)
scanf(\"%d\",

for(i=0;i19;i)
for(j=i 1;j20;j)
if(aa[j])
{

t=a;

a=a[j];

a[j]=t;
}

printf(\"3个最大数:%d,%d,%d\\n\",a[17],a[18],a[19]);
printf(\"3个最小数:%d,%d,%d\\n\",a[0],a[1],a[2]);
getchar();
}
回复

使用道具 举报

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

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行