Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package lab1;
- import java.util.*;
- public class Lab1
- {
- private static Random rand = new Random();
- public static void main(String[] args)
- {
- int N = 3;
- int[][] A = new int[N][N];
- System.out.println("Матрица: ");
- for(int i = 0; i < N; i++)
- {
- for(int j = 0; j < N; j++)
- {
- A[i][j] = rand.nextInt(10);
- System.out.format("%4d", A[i][j]);
- }
- System.out.println();
- }
- int det=((A[0][0] * A[1][1] * A[2][2])
- +(A[0][1] * A[1][2] * A[2][0])
- +(A[0][2] + A[1][0] + A[2][1]))
- -((A[0][2] * A[1][1] * A[2][0])
- +(A[1][0] * A[0][1] * A[2][2])
- +(A[2][1] + A[1][2] + A[0][0]));
- System.out.println("Детерминант = " + det);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement