OneCompiler

How to find the sum of uppercase triangle element

140
import java.util.*;

public class Main {
    public static void main(String[] args) {
      int a[][]={{1,2,3},{4,5,6},{7,8,9}};
      int sum=0;
      for(int i=0;i<a.length;i++){
        for(int j=a.length-1;j>=i;j--){
          sum=sum+a[i][j];
        }
      }
      System.out.println(sum);
  }
}