View Code of Problem 51


import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		n++;
		int res = 0;
		int[][] a = new int[n][n];
		for (int i = 1; i < n; i++) {
			for (int j = 1; j < n; j++) {
				a[i][j] = scanner.nextInt();
				if(i>=j) {
					res+=a[i][j];
				}
			}

		}
		System.out.print(res);
	
	}
}

Double click to view unformatted code.


Back to problem 51