0% found this document useful (0 votes)
40 views2 pages

Simple Pyramid

Uploaded by

Mahamad Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
40 views2 pages

Simple Pyramid

Uploaded by

Mahamad Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 2
File - C:\UsersdeltideaProjects\Top30PattemsinJavalsre\SimplePyramiPattem.java 1 public class SimplePyramidPattern { 2 public static void printTriangle( int n) 3 { 4 // outer loop to handle number of rows 5 // nin this case 6 for (int i=0; i1; j--) 12 { 13 // printing spaces 14 System.out.print(" " di 15 + 16 17 // inner loop to handle number of columns 18 // values changing acc. to outer loop 19 for (int j=0; j<=i; j++ ) 20 { 21 // printing stars 22 System.out.print("* " Page 1 0f2 File - C:\UsersdeltideaProjects\Top30PattemsinJavalsre\SimplePyramiPattem.java 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 di } // ending line after each row System.out.printin(); } // Driver Function public static void main(String args[]) { int n= 5; printTriangle(n); /* * x * kK kK EK KK KKK */ Page 2 0f2

You might also like