Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (6.1k points)

                     $ 

                  $$ 

               $$$ 

            $$$$ 

         $$$$$ 

      $$$$$$ 

   $$$$$$$ 

$$$$$$$$

1 Answer

0 votes
by (11.7k points)

 You can draw this pattern in Java with the following code:

public static void main(String[] args) {

 final int length = 10;

 for (int a = 1; a < length; a++) {

 

for (int b = length - 1; b > a; b--) {

 

System.out.print(" ");

 }

for (int b = 1; b <= a; b++) 

{

 System.out.print("$");

 } 

System.out.println(); 

 }

 }

Related questions

0 votes
1 answer
0 votes
1 answer
asked Feb 25, 2021 in Java by RohitSingh (2.6k points)
0 votes
1 answer
asked Feb 18, 2021 in Java by dante07 (13.1k points)
0 votes
1 answer
0 votes
1 answer
asked Apr 6, 2021 in Java by Jake (7k points)

Browse Categories

...