1#include <stdio.h>2 3 voidShowdet (intNintd[n][n]);4 intGetval (intNintd[n][n]);5 intGeta (intNintd[n][n],intXinty);6 7 intMainintargcChar*Argv[])8 { 9 do{Ten intn,i,j; oneprintf"Please enter the order of the determinant (enter 0 exit): \ n"); ascanf"%d",&n); - if(n==0) break; -printf"Please enter a determinant (space-delimited): \ n"); the intd[n][n]; - for(i=0; i<n;i++){ - for(j=0; j<n;j++){ -scanf"%d",&d[i][j]); + } - } +printf"\ n The input determinant is as follows: \ n"); a Showdet (n,d); atprintf"\ n The value of the determinant is: \n%d\n\n\n", Getval (n,d)); - -} while(1); - return 0; - } - in voidShowdet (intNintD[n][n]) { - inti,j; to for(i=0; i<n;i++){ + for(j=0; j<n;j++){ -printf"%d\t", d[i][j]); the } *printf"\ n"); $ }Panax Notoginseng } - the intGetval (intNintD[n][n]) { + if(n = =1)returnd[0][0]; a inti,j,sum=0; the + for(i=0; i<n;i++){ -sum=sum+d[0][i]*geta (n,d,1, i+1); $ } $ returnsum; - } - the intGeta (intNintd[n][n],intXintY) { - inta[n-1][n-1],i,j;Wuyi for(i=0; i<n;i++){ the if(i==x-1)Continue; - for(j=0; j<n;j++){ wu if(j==y-1)Continue; - Else if(i<x-1&& j<y-1){ abouta[i][j]=d[i][j]; $}Else if(i<x-1&& j>y-1){ -a[i][j-1]=d[i][j]; -}Else if(i>x-1&& j<y-1){ -a[i-1][j]=d[i][j]; a}Else if(i>x-1&& j>y-1){ +a[i-1][j-1]=d[i][j]; the } - } $ } the intt; thet = (x+y)%2==0?1:-1; the returnT*getval (n1, a); the}
C-language-integer determinant