[试题]

以下程序的输出结果是 ( 11 ) 。

#include <stdio.h>

int fun(int x)

{ static int t=0;

return(t+=x);

}

main()

{ int s,i;

for(i=1;i<=5;i++) s=fun(i);

printf("%d/n",s);

}

参考答案与解析:

相关试题

以下程序的输出结果是#include <stdio.h>int fun(int

[主观题]以下程序的输出结果是#include <stdio.h>int fun(int x){ static int m=0; return(m *=x);}main(){ int s,i; for(i=l;i<=3;i++) s=fun(i); printf("%d/n",s);}

  • 查看答案
  • 以下程序的输出结果是#include <stdio.h>main(){ int

    [主观题]以下程序的输出结果是#include <stdio.h>main(){ int k=4,s=0; do{ if((k%3)==0) continue; s+=k;k++; }while(k>10); printf("s=%d/n",s);}

  • 查看答案
  • 以下程序的输出结果是#include <stdio.h>main(){ int

    [单选题]以下程序的输出结果是include <stdio.h>main(){ int a,b,d=241;a=d£¯100%9;b=(£­1)&&am以下程序的输出结果是#include <stdio.h>main(){ int a,b,d=241; a=d/100%9; b=(-1)&&(-1); printf("%d,%d/n",a,b);}A.6,1 B.6,0 C.2,1 D.2,0

  • 查看答案
  • 以下程序的输出结果是 #include<stdio.h> int fun(int

    [单选题]以下程序的输出结果是#include<stdio.h>int fun(int n,int *s){ int f1,f2;if(n==0||n==1)*s=1;else{ fun(n-1,&f1);fun(n-2,&f2);*s=f1+f2;} }void main(){ int x;fun(6,&x);printf("/n%d",x);}A.7B.13C.9D.10

  • 查看答案
  • 以下程序的输出结果是 ( 11 ) 。#include <stdio.h>voi

    [试题]以下程序的输出结果是 ( 11 ) 。#include <stdio.h>void swap(int *a,int *b){ int *t;t=a; a=b; b=t;}main(){ int i=3,j=5,*p=&i,*q=&j;swap(p,q); printf("%d %d/n",*p,*q);}

  • 查看答案
  • 以下程序的输出结果是 ( 11 )。#include <stdio.h>main

    [试题]以下程序的输出结果是 ( 11 )。#include <stdio.h>main( ){ char *ch[4]={"red',"green","blue"};int i=0;while( ch[i] ){ putchar( ch[i][0]); i++;)}

  • 查看答案
  • 以下程序的输出结果是 #include<stdio.h> main() {int

    [单选题]以下程序的输出结果是#include<stdio.h>main(){int a=15,b=21,m=0;switch(a%3){case 0:m++;break;case 1:m++;switch(b%2){ default:m++;case 0:m++;break; } }printf("%d/n",m);}A.1B.2C.3D.4

  • 查看答案
  • 以下程序的输出结果是#include <stdio.h>main(){int i

    [主观题]以下程序的输出结果是#include <stdio.h>main(){ int i,j,sum; for(i=5;i>=1;i--) { sum=0; for(j=i;j<=i;j++) sum+=i*j; } printf("%d/n",sum);}

  • 查看答案
  • 以下程序的输出结果是#include <stdio.h>main(){int j

    [主观题]以下程序的输出结果是#include <stdio.h>main(){ int j, a[]={1,3,5,7,9,11,13,15},*p=a+5; for(j=3; j; j--) { switch(j) { case 1: case 2: printf("%d",*p++); break; case 3: printf("%d",*(--p)); } }}

  • 查看答案
  • 以下程序的输出结果是 #include<stdio.h> int a[3][3]

    [单选题]以下程序的输出结果是#include<stdio.h>int a[3][3]={1,2,3,4,5,6,7,8,9,},*p;main(){ p=(int*)malloc(sizeof(int));f(p,a);printf("%d/n",*p);free(p); }f(int *s, int p[][3]){ *s=p[1][1];}A.1B.4C.7D.5

  • 查看答案
  • 以下程序的输出结果是 ( 11 ) 。#include <stdio.h>int