Write a program in java to display right triangle.
Program:
package prog1;
public class right_tri {
public static void main(String[] args) {
// TODO Auto-generated method stub
int n=6;
//Scanner.in=nextInt;
//n=
for ( int i=1 ; i<=n ; i++ )
{
for (int j = 1 ; j<=i ; j++ )
{
System.out .print("* ");
}
System.out.println();
}
}
}
Output: right traingle is :
*
* *
* * *
* * * *
* * * * *
* * * * * *