FastFoodCoding

Login


Connect with one of the following accounts





Login

Please wait while we redirect...

Views: 249   



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:

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



On By


Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News