1 / 8
文档名称:

C语言经典例题(带答案).doc

格式:doc   大小:87KB   页数:8页
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

C语言经典例题(带答案).doc

上传人:小雄 2021/5/15 文件大小:87 KB

下载得到文件列表

C语言经典例题(带答案).doc

文档介绍

文档介绍:C语言复****题纪实解答(有好方法的互相交流!)
题:
#include ""
main()
{
float i,s=0;
for(i=3 ;i<= 10;i++)
{
s=s+(i+2)*(i+3)/(i+4);
}
printf(ns=%.2f",s);
_}
题:
#include ""
void main()
(int score;
scanf(n%dn,&score);
switch(score/5)
{
case 20:
case 19:
case 18:printf(HA\n");break;
case 17:
case 16:
case 15:printf(nB\nn);break;
case 14:
case 13:
case 12:printf("C\n");break;
case 11:
case 10:
case 9:
case 8:
case 7:
case 6:
case 5:
case 4:
case 3:
case 2:
case 1:
case 0:printf(H D I'm so sorry your IQ==0 \n");break;
defaultrbreak;
}
题:(if语句)
#include ""
main()
(
int x,y;
scanf("%d",&x);
if(x<-5) y=x;
if(x>=-5 &&x<=0) y=x+l;
if(x>0&&x<=5) y=x-l;
if(x>5) y=2*x;
printf("y= %d\n",y);
题:
有谁会第四题给我发来。
我真的不会啊!!!!
题:

#include ""
void main()
(
int max_value(int a[3][3]);
int i,j,a[3][3]={3,8,.2,5,6,10,4,9,18};
for(i=0;i<3;i++)
{ for(j=0;j<3;j++)
(
printf("%d ",a[i][j]); /*此部分为显示出矩阵(4~8行)可无*/
)
printf("\n");
}
printf(u\n the max is: %d\n",max_value(a));
}
int max_value(int a[3][3])
(
int i,j,max;
i=0;
max=a[O][O];
for(j=0;j<3;j++)
{
if(a[i][j]>max)
max=a[i][j];
}
return (max);
}
二、在以一的基础上修改:
#include ""
void main()
{
int max_value(int a[3][3]);
inti,j,a[3][3]={3,8,-2,5,6,10,4,9,18};
printf("\n the max is: %d\nn,max_value(a));
}
int max_value(int a[3][3])
{
int i,j,max;
max=a[0] [0];