Solution in Java

            
    public static void main(String[] args) throws IOException {
        System.out.print("Enter height: ");
        int N = new Scanner(System.in).nextInt();
        for (int nRow = 1; nRow <= N; nRow++) {
            for (int nColumn = 1; nColumn <= N; nColumn++) {
                if (nColumn <= N - nRow) {
                    System.out.print(" ");
                } else {
                    System.out.print("#");
                }
            }
            System.out.println();
        }
    }