MCPcopy Create free account
hub / github.com/Manvityagi/PW-Skills-Java-Course-Codes / main

Method main

Lecture 23/src/RectangleSum.java:67–89  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

65 }
66
67 public static void main(String[] args) {
68 Scanner sc = new Scanner(System.in);
69 System.out.println("Enter number of rows and columns of matrix");
70 int r = sc.nextInt();
71 int c = sc.nextInt();
72 int[][] matrix = new int[r][c];
73 int totalElements = r * c;
74 System.out.println("Enter " + totalElements + " values");
75 for (int i = 0; i < r; i++) {
76 for (int j = 0; j < c; j++) {
77 matrix[i][j] = sc.nextInt();
78 }
79 }
80
81 System.out.println("Enter rectangle boundaries l1, r1, l2, r2");
82 int l1 = sc.nextInt();
83 int r1 = sc.nextInt();
84 int l2 = sc.nextInt();
85 int r2 = sc.nextInt();
86
87 System.out.println("Rectangle Sum " + findSum(matrix, l1, r1, l2, r2));
88 System.out.println("Rectangle Sum " + findSum3(matrix, l1, r1, l2, r2));
89 }
90}

Callers

nothing calls this directly

Calls 2

findSumMethod · 0.95
findSum3Method · 0.95

Tested by

no test coverage detected