題目:求一個(gè)3*3矩陣對(duì)角線元素之和
There is no nutrition in the blog content. After reading it, you will not only suffer from malnutrition, but also impotence.
The blog content is all parallel goods. Those who are worried about being cheated should leave quickly.文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-854076.html
1.程序分析:利用雙重for循環(huán)控制輸入二維數(shù)組,再將a[i][i]累加后輸出。
2.程序源代碼:
main()
{
float a[3][3],sum=0;
int i,j;
printf("please input rectangle element:\n");
for(i=0;i<3;i++)
for(j=0;j<3;j++)
scanf("%f",&a[i][j]);
for(i=0;i<3;i++)
sum=sum+a[i][i];
printf("duijiaoxian he is %6.2f",sum);
}文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-854076.html
到了這里,關(guān)于題目:求一個(gè)3*3矩陣對(duì)角線元素之和的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!