C语言小代码
摘要:1.#include<stdio.h>voidmain(){inta[20],j;for(j=0;j<20;j++)a[j]=j;for(j=19;j>=0;j--)printf("%2d",a[j]);printf("\n");}2.#include<stdio.h>voidmain(){inti;intf[20]={1,1};for(i=2;i<20;i++)f[i]=f[i-2]+f[i-1];for(i=0;i<20;i++){if(i%5==0)printf("\n");printf("%12d",f[i]);}printf("\n");}3.include<stdio.h>#defineN5voidmain(){floatscore[N],ave,sum=0.0;intnum[N],i,max,min;max=0,min=0;printf("inputnumandscoreofstduent:\n");for(i=0;i<N;i++){scanf("%d%f",&num[i],&score[i]);sum+=score[i];}ave=sum/N;for(i=0;i<N;i++){if(score[i]>score[max])max=i;if(score[i]<score[min])min=i;}printf("average:%6.2\n",ave);printf("themaximumscore:%d%6.2f\n",num[max],score[max]);printf("theminimum%6.2f\n",num[min],sc
温馨提示:当前文档最多只能预览
5 页,若文档总页数超出了
5 页,请下载原文档以浏览全部内容。
本文档由 匿名用户 于 2022-10-10 23:09:14上传分享