0% found this document useful (0 votes)
52 views

Star 1.java

This Java program prints a pattern of stars in the shape of a triangle. It contains two nested for loops, with the outer loop iterating 4 times for each of the 4 rows, and the inner loop printing stars from 0 to the current row number i. This prints stars in increasing number from left to right on each line to create a triangular pattern of stars.

Uploaded by

ohmygodhritik
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views

Star 1.java

This Java program prints a pattern of stars in the shape of a triangle. It contains two nested for loops, with the outer loop iterating 4 times for each of the 4 rows, and the inner loop printing stars from 0 to the current row number i. This prints stars in increasing number from left to right on each line to create a triangular pattern of stars.

Uploaded by

ohmygodhritik
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

import java.io.*; public class Star_1 { public static void main(String arr[]) { int i,j; for(i=0;i<4;i++) { for(j=0;j<i;j++) { System.out.

print("*"); } System .out.println( ); } } }

Output:

You might also like