Advertisement
Guest User

Untitled

a guest
Dec 17th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.62 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. int matrix(int a[100][100],int i,int j)
  4. {
  5.     int p, q, r, s;
  6.     if (a[i][j] == a[0][0])
  7.     {
  8.         p = a[0][0] * ((a[1][1] * a[2][2]) - (a[1][2] * a[2][1]));
  9.     }
  10.     if (a[i][j] == a[0][1])
  11.     {
  12.         q = a[0][1] * ((a[1][2] * a[2][1]) - (a[1][0] * a[2][2]));
  13.     }
  14.     if (a[i][j] == a[0][2])
  15.     {
  16.         r = a[0][2] * ((a[1][0] * a[2][1]) - (a[2][0] * a[1][1]));
  17.     }
  18.     s = p - q + r;
  19.     return matrix(s[i][j],i+1,j+1);
  20. }
  21. int main()
  22. {
  23.     int a[100][100], i, j,n,s;
  24.     scanf("%d", &n);
  25.     for (i = 0; i < n; i++)
  26.     {
  27.         for (j = 0; j < n; j++)
  28.         {
  29.             scanf("%d", &a[i][j]);
  30.         }
  31.     }
  32.     matrix(a, 0, 0);
  33.     printf("Result : %d \n", s);
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement