I wrote a program that prints a triangle with smaller at top and bigger at bottom. I'm trying to do the reverse, for example:
*****
****
***
**
*
But this program just keeps spitting out **********************
What have I done wrong? It doesn't make sense because I've just reversed what I did for
*
**
***
****
*****
Code:import javax.swing.JOptionPane; //import JOptionPane
class triangle1 {
public static void main(String[] args) {
String asterix = "*";
String number=JOptionPane.showInputDialog(null, "Enter triangle size:"); //Get number1 using JOptionPane
int n = Integer.parseInt(number); //convert number string to n int
for (int i = n; i <= n; i--) {
for (int j = n; j <= i; j--)
{ System.out.print("*");
}
// print a new line
System.out.println();
}
}
}

