填空题

以下程序的功能是:求出数组x中各相邻两个元素的和依次存放到a数组中,然后输出。请填空。 main() {int x[10],a[9],i; for(i=0;i<10;i++)scanf("%d",&x[i]); for( [11] ;i<10;i++) a[i-1]=x[i]+ [12] ;. for(i=0;i<9;i++)printf("%d",a[i]); printf(""); }

【参考答案】

[11] i=1
<上一题 目录 下一题>
热门 试题

填空题
以下程序的功能是建立—个带有头结点的单向链表,链表结点中的数据通过键盘输入,当输入数据为-1时,表示输入结束(链表头结点的data域不放数据,表空的条件是ph->next==NULL),请填空。#include<stdio.h>struct list { int data;struct list *next;};struct list * creatlist(){ struct list *p,*q,*ph;int a;ph=(struct list *)malloc(sizeof(struct list));p=q=ph;printf( Input an integer number;entre-1 to end: n );scanf( %d ,&a);while(a!=-1){ p=(struct list*)malloc(sizeof(struct list));[14] =a;q->next=p; [15] =p;scanf( %d ,&a);}p->next=’ 0’;return(ph);}main(){stuct list * head;head=creatlist();}
填空题
以下程序的运行结果是______。#include<stdio.h>long fib(int g){ switch(g){ case 0:return 0;case 1:case 2:return 1;}return(fib(g-1)+fib(g-2));}main(){ long k;k=fib(5);printf( k=%51d n ,k);}
相关试题
  • 设有如下三个关系表Amn
  • 已知二叉树后序遍历序列是dabec,中序遍历...
  • 下列叙述中,不属于测试的特征的是
  • 算法的空间复杂度是指
  • 已知大写字母A的ASCII码是65,小写字母a...