Social Sciences, asked by SamarthR, 8 months ago

write a java program to display the given patterns:
*
***
*****
*******
*********

7777777
66666
555
4

1
222
33333
444444
5555555

1
212
32123
4321234
543212345​

Answers

Answered by ShakuntalamGhosh
1

Here is your answer..

Hope this helps...you...

public class Edureka

{

public static void rightTriangle(int n)

{

int i, j;

for(i=0; i<n; i++) //outer loop for number of rows(n) { for(j=2*(n-i); j>=0; j--) // inner loop for spaces

{

System.out.print(" "); // printing space

}

for(j=0; j<=i; j++) // inner loop for columns

{

System.out.print("* "); // print star

}

System.out.println(); // ending line after each row

}

}

public static void main(String args[])

{

int n = 5;

rightTriangle(n);

}

}

Please mark Brainliest.

Similar questions