以下程序的输出结果是________。
#include "stdio.h"
int f(int b[],int m,int n)
{ int i,s=0;
for(i=m; i < = n; i=i+2)
s=s+b[i];
return s; }
void main()
{ int x,a[]={1,2,3,4,5,6,7,8,9};
x=f(a,3,7);
printf("%d",x);
}: 10/#/15/#/18/#/8
#include "stdio.h"
int f(int b[],int m,int n)
{ int i,s=0;
for(i=m; i < = n; i=i+2)
s=s+b[i];
return s; }
void main()
{ int x,a[]={1,2,3,4,5,6,7,8,9};
x=f(a,3,7);
printf("%d",x);
}: 10/#/15/#/18/#/8
举一反三
- 【单选题】下面程序执行后的输出结果是()。#include <stdio.h>int main(){int i=0,s=0;for (;;) {if(i==3||i==5) continue;if (i==6) break;i++; s+=i;};printf("%d",s); return 0;}#include <stdio.h>int main(){int i=0,s=0;for (;;) {if(i==3||i==5) continue;if (i==6) break;i++; s+=i;};printf("%d",s); return 0;}#include <stdio.h>int main(){int i=0,s=0;for (;;) {if(i==3||i==5) continue;if (i==6) break;i++; s+=i;};printf("%d",s); return 0;}#include <stdio.h>int main(){int i=0,s=0; A. 10 B. 13 C. 21 D. 死循环
- 中国大学MOOC: 下面程序执行后的输出结果是( )。#include int main(){ int i=0,s=0; for (;;) { if(i==3||i==5) continue; if (i==6) break; i++; s+=i; }; printf(%d,s); return 0;}#include int main(){ int i=0,s=0; for (;;) { if(i==3||i==5) continue; if (i==6) break; i++; s+=i; }; printf(%d,s); return 0;}#include int main(){ int i=0,s=0; for (;;) { if(i==3||i==5) continue; if (i==6) break; i++; s+=i; }; printf(%d,s); return 0;}#include int main(){ int i=0,s=0; for (;;) { if(i==3||i==5) continue;
- 以下程序的运行结果是 _____ 。 #include int main() { int i=2,x=5,j=7; void fun(int i,int j); fun(j,6); printf("i=%d; j=%d; x=%d\n",i,j,x); return 0; } void fun(int i,int j) { int x=7; printf("i=%d; j=%d; x=%d\n",i,j,x); }
- 以下程序的输出结果是 main() { int a[] = {1, 2, 3, 4}, i, x = 0; for(i = 0; i < 4; i++) { sub(a, &x); printf(“%d ”, x); } pritnf(“\n”); } sub(int *s, int *y) { static int t = 3; *y = s[t]; t--; }
- 以下程序运行后的输出结果是________。 #include "stdio.h" int f(int x); void main() { int n=1,m; m=f(f(f(n))); printf("%d",m); } int f(int x) {return x*2;}: 1/#/2/#/4/#/8