首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序: #include #define N 4 int fun(int a[][N]) {int i,j,x=0; for(i=0;i
有以下程序: #include #define N 4 int fun(int a[][N]) {int i,j,x=0; for(i=0;i
admin
2016-04-07
17
问题
有以下程序:
#include
#define N 4
int fun(int a[][N])
{int i,j,x=0;
for(i=0;i
for(j=0;j
if(i==j)
x+=a[N一1—j]
;
return x;
}
main()
{int X[N][N]={{1,2,3,4},
{5,6,7,8},
{9,10,11,12}’
{13,14,15,17}},y;
Y=fun(X);
printf("%d\n",y);
}
程序运行后的输出结果是( )。
选项
A、34
B、35
C、2s
D、59
答案
A
解析
fun()函数求矩阵反对角线的元素之和。根据:tun()函数,当数组的行列下标相等时,对该行反对角线上的元素求和。故结果为4+7+11+13=34,答案为A选项。
转载请注明原文地址:https://kaotiyun.com/show/GtDp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
下列程序的功能是对输入的一行字符中的数字字符的字面值累加,输出此累加和,请填空。#include<stdio.h>#include<ctype.h>main(){charc;inta,s=0;whil
设q1和q2是指向一个float型一维数组的指针变量,k为float型变量,则不能正确行的语句是()。
下列程序段的运行结果是______。intx=0,y=0;while(x<15)y++,x+=++y;printf("%d,%d",y,x);
按照逻辑结构分类,结构可以分为线性结构和非线性结构,栈属于______。
深度为5的满二叉树中,叶子结点的个数为______。
若有定义:inta[4][10];,则以下选项中对数组元素a[i][j]引用错误的是______。(o<=i<4,0<=j<=10
下列数据结构中,能用二分法进行查找的是______。
若有说明inta[][3]={0,0};,则不正确的叙述是()。
以下叙述中正确的是______。
已知二叉树后序遍历序列是dabec,中序遍历序列是debac,它的前序遍历序列是
随机试题
四分位数间距主要用于()
不符合电击伤特点的是()
吸收
如图5.4—20所示的岩石边坡,开挖后发现坡体内有软弱夹层形成的滑面AC,倾角β=42°,滑面的内摩擦角φ=18°。滑体ABC处于临界稳定状态,其自重为450kN/m。若要使边坡的稳定安全系数达到1.5,每延米所加锚索的拉力P最接近下列哪个选项?(锚索下倾
2002年12月,大华汽车贸易公司与东方公司订立了一份汽车买卖合同。约定:大华汽车贸易公司于2003年2月向东方公司交付新汽车一辆,价款22万元,并约定由东方公司向大华汽车贸易公司付30%定金。合同订立10天内,东方公司依约向大华汽车贸易公司付定金6600
首次公开发行公司在发行前,必须以( )的方式,向投资者进行公司推介。
陈某向王某购买货物,价款为10万元,合同签订后,陈某向王某支付了2万元作为定金。交货期限届满后,因为第三方供货迟延,致使王某只向陈某交付了一半的货物,陈某因此主张适用定金罚则,要求王某承担定金责任,王某不同意。下列关于是否适用定金罚则的表述中,符合合同法律
3名医生和6名护士被分配到3所学校为学生体检,每校分配1名医生和2名护士,不同的分配方法共有()种.
OnSeptember7,2001,a68-year-oldwomaninStrasbourg,France,hadhergallbladder(胆囊)removedbysurgeonsoperating,viacomp
PublicViewsontheAnti-TerrorismAct(Canada)A)ThisreportispartoftheongoingeffortsundertakenbytheResearchandSt
最新回复
(
0
)