单项选择题

有以下程序:
#include <stdio.h>
int fun(int n)
if(n==1) return 1;
else
return(n+fun(n-1));

main()
int x;
scanf("%d", &x); x=fun(x); printf("%d\n", x);

执行程序时,给变量x输入10,程序的输出结果是()。

A. 55
B. 54
C. 65
D. 45

<上一题 目录 下一题>
热门 试题

单项选择题
有以下程序: #include <stdio.h> void fun(char *t, char *s) while(*t!=0) t++; while((*t++=*s++) !=0); main() char ss[10]= acc , aa[10]= bbxxyy ; fun(ss, aA); printf( %s, %s n , ss, aA); 程序的运行结果是()。

A. accxyy, bbxxyy
B. acc, bbxxyy
C. accxxyy, bbxxyy
D. accbbxxyy, bbxxyy

单项选择题
以下正确的程序段是()。

A. char str[20];
scanf("%s", &str);
B. char *p;
scanf("%s", p);
C. char str[20];
scanf("%s", &str[2])
D. char str[20], *p=str;
scanf("%s", p[2]);

相关试题
  • 有以下程序: #include <stdio.h> m...
  • 有以下程序: #include <stdio.h> m...
  • 若有以下定义的语句: struct student i...
  • 以下程序的输出结果是( )。 struct HA...
  • 阅读下列程序段,程序的输出结果为( )。...