2、更新最小值*/}printf("highestis%d,lowestis%d",max,min);/*输出结果*/}2)n个数存放在二维数组#includevoidmain(){inta[3][3]={lz3z24,3,4,5,9,18,0};intmax,min,i,j;max=min=a[0][0];for(i=0;i<3;i++)for(j=0;jv3;j++){if(maxa[i][j])min=a[i][j];}printf("max=%
3、d,min=%dnzmaxzmin);}3)n个数存放在文件屮,结杲输出到文件小。#includevoidm8in(){inta[3][3];FILE*fin,*fout;intmax,min,ijzn;if((fin=fopen("fl_3.txt,7,w+,'))==NULL){printf(Hfl_3.txtnotopen!");exit(l);}/*创建文件fl_3.txt,先从键盘输入9个数写到文件,再从文件读到数组a*/printf(Tnput9numbers:");fo「(i=0;iv
4、9;i++){scanf("%d,,/&n);fprintf(finzn%4dH,n);}rewind(fin);fo「(i=0;iv3;i++)for(j=0;jv3;j++){fscanf(finzn%d"z&a[i][j]);}max=min=a[O][O];for(i=0;iv3;i++)for(j=0;j<3;j++){if(maxa[i][j])min=a[i][j];}if((fout=fopen(,,fl_3out.txt,,z,,w"))==NULL)
5、{printf(Hfl_3out.txtcannotopen!");exit(l);}fprintf(foutznmax=%d,min=%dnzmax,min);printf(l,max=%dzmin=%drT;maxFmin);}2)输入n个字符串,求最大(最小)字符串#include#includevoidmain(){chars[][20]={Happle,,/,mongo,7,orange,7,bananaHzHpearn};inti;char*min,*max;max
6、=min=s[0];for(i=0;iv5;i++){if(strcmp(maxzs[i])<0)max=s[i];if(strcmp(min,s[i])>0)min=s[i];}printf("max=%s,min=%s"zmaxzmin);}1.判断闰年。输入一个年份,判断其是否是闰年。1)不用函数#includeintmain(){intyear;printf("inputyear:");scanf("%d"z&year);if(year%4==0&&yea「%100!=011year%400==
7、0)printf("%disaleapyear!”,year);elseprintf("%disnotaleapyear!”zyear);}2)用函数#includeintleap(intyear)return(year%4==0&&ye8「%100!=011year%400==0);}intmain(){intyear;printf("inputyear:");scanf(n%d",&year);if(leap(year))printf("%disaleapyear!”,year);elsep
8、rintf("%disnotaleapyear!jyear);}3)对一个口期结构体变量判断闰年。#includetypedefstruct{intyear,month,day;}DAY;DAYget(inty,intm,intd){DAYdl;dl.year=y;d