jackzxv140
|
分享:
▲
▼
#include<stdio.h> int main(void) { int i , max ,min , sum = 0 ; int n[ 5 ] ; printf( "请输入任意5个正整数\n" ) ; for ( i = 0 ; i <= 4 ; i++ ) scanf( "%d" , &n[ i ] ) ; max = n[ 0 ] ; min = n[ 0 ] ; for ( i = 0 ; i <= 4 ; i++ ) { if ( max < n [ i ] ) max = n[ i ] ; else if ( min > n [ i ] ) min = n[ i ] ; sum += n[ i ]; } printf( "最大值%d\n最小值%d\n平均值%0.1f " , max , min , sum / 5.0 ) ; getch() ; return 0 ; } 不晓得是不是你要斗~QQ
[ 此文章被jackzxv140在2007-01-07 17:31重新编辑 ]
|