首页
/
每日頭條
/
生活
/
行列式的計算c語言實現
行列式的計算c語言實現
更新时间:2025-12-24 08:01:49

很多學線性代數的小夥伴在計算3階行列式的時候總會感到很麻煩,數據量大而且容易看錯。我們在知道計算方法後就可以使用c語言寫出計算3階行列式的代碼:

#include<stdio.h> int main() { while(true) { int i,a[3][3],j,sum1,sum2,sum; for(i=0;i<3;i ) { for(j=0;j<3;j ) scanf("%d",&a[i][j]); } sum1=a[0][2]*a[1][0]*a[2][1] a[0][1]*a[1][2]*a[2][0] a[0][0]*a[1][1]*a[2][2]; sum2=a[2][2]*a[0][1]*a[1][0] a[2][1]*a[1][2]*a[0][0] a[0][2]*a[1][1]*a[2][0]; sum=sum1-sum2; printf("%d\n",sum); } }

在進行計算的時候隻需要将輸入行列式就可以直接計算出結果:

行列式的計算c語言實現(使用c語言計算3階行列式)1

這樣就可以很方便很快捷計算3階行列式了。

行列式的計算c語言實現(使用c語言計算3階行列式)2

,
Comments
Welcome to tft每日頭條 comments! Please keep conversations courteous and on-topic. To fosterproductive and respectful conversations, you may see comments from our Community Managers.
Sign up to post
Sort by
Show More Comments
Copyright 2023-2025 - www.tftnews.com All Rights Reserved