WAP to print Right Triangle Pattern in Java

1 year ago
OOP Java

   *

   * *

   * * *

   * * * *

   * * * * *

 

Compile code:

public class RightTrianglePattern   {   
public static void main(String args[])   
{    
int i, j, row=6;     
for(i=0; i<row; i++)   
{    
for(j=0; j<=i; j++)   
{   
System.out.print("* ");   
}   

System.out.println();   
}   
}   
}  

 

Output:

0
Dipti KC
Jan 8, 2023
More related questions

Questions Bank

View all Questions