单项选择题

有以下程序:
#include <stdio.h>
int fun(int n)
if(n == 1) return 1;
else return( n + fun( n - 1 ) );main( )
int x;
seanf("% d" ,&X) ;x = fun(x) ;pfinff( "% d \n" ,x); 执行程序时,给变量x输入10,程序的输出结果是( )。

A.55
B.54
C.65
D.45
<上一题 目录 下一题>
热门 试题

单项选择题
现有以下结构体说明和变量定义,如图所示,指针P,q,r分别指向一个链表中连续的三个结点。 struct node char data; struct node *next; *p,*q,*r; 现要将q和r所指结点交换前后位置,同时要保持链表的连续,以下不能完成此操作的语句是( )。
单项选择题
要求通过while循环不断读入字符,当读入字母'N'时结束循环。若变量已正确定义,以下正确的程序段是( )。
A.while(( ch = getchar( )) ! ='N') printf(" %c",ch);
B.while(ch = getehar() ! ='N')printf("%c",ch);
C.while (ch = getehar() = = 'N')printf( "%c", ch);
D.while ((ch = getchar( )) == 'N')printf("%c", ch );
相关试题
  • 有以下程序: #include <stdio.h> m...
  • 执行以下程序后,test.txt文件的内容是(...
  • 有以下程序: #include <stdio.h> i...
  • 有以下程序:#include <stdio.h>fun(...
  • 有以下程序:#inelude <stdio.h>main...