logo image

Right Angled Triangle with stars in Java



Java program to print a Right Angled Triangle with stars. It takes the size as input and prints the triangle of that size (Number of rows as height)

public class RightAngledTriangle {
	public static void main(String[] args) {

		int size = 10;
		
		for (int i = 1; i <= size; i++) {
			for (int j = 0; j < i; j++) {
				System.out.print("*");
			}
			System.out.println("");
		}

	}

}

Output:

*
**
***
****
*****
******
*******
********
*********
**********