下列程序的功能是计算1~100的整数的累加和。 main() { int i, sum=【 】; i=1;
下列程序的功能是计算1~100的整数的累加和。 main() { int i, sum=【 】; i=1; for(【 】) { sum+=i; i++; } printf("sum=%d\n",【 】); }
下列程序的功能是计算1~100的整数的累加和。 main() { int i, sum=【 】; i=1; for(【 】) { sum+=i; i++; } printf("sum=%d\n",【 】); }
第1题
输出若干学生3门课程的成绩。 include <stdio.h> 【 】 struct student { int num; float score[3]; } main () { int i=0, n; float a[3]; 【 】*ptr [200]; printf ("请输入学生学号和3门课成绩,学号为0表示数据输入结束\n"); do { ptr[i]=(struct student *)malloc(sizeof(struct student)); scanf("%d%f%f%f",&ptr[i]->num,&a[O],&a[1],&a[2]); ptr[i]->score[O]=a[O]; ptr[i]->score[1]=a[1]; ptr[i]->score[2]=a[2]; if(【 】) break; i++; }while(1); n=i-1; 【 】; for(i=O;i<=n;i++) printf("%-6d%.1f %.1f %.1f\n",ptr[i]->num, ptr[i]->score[0], ptr[i]->score[1], ptr[i]->score[2]); }
请帮忙给出正确答案和分析,谢谢!
第2题
下列程序的运行结果为【 】。 main ( ) { int i, j, row=0, colum=0, max, a[3] [4]={{1,2,3,4}, {9,8,7,6}, {-10,10,-5,2}}; max=a[0] [0]; for (i=0;i<3;i++) for (j=0; j<4; j++) if (max<a [i] [j]) { max=a[i] [j]; row=i; colum=j; } printf("max=%-5d row=%-3d colum=%-3d\n",max, row, colum); }
请帮忙给出正确答案和分析,谢谢!
第4题
下列程序的运行结果为【 】。 main ( ) { int a,b, c,x,y, z; a=10;b=2; c=! (a%b) ;x=! (a/b); y=(a<b) && (b>=0); z=(a<b) || (b>=0); printf ("c=%d, x=%d, y=%d, z=%d\n", c,x, y, z); }
请帮忙给出正确答案和分析,谢谢!
为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!