Answer to Question #276130 in Java | JSP | JSF for Candy

Question #276130

Write a main()routine that uses the subroutine that you wrote for part (a) to output 10 lines of stars with 1 star in the first line, 2 stars in the second line, and so on, as shown below. ( 6 marks)

*_*_*_*_*_*_*_*_*_*

*_*_*_*_*_*_*_*_*

*_*_*_*_*_*_*_*

*_*_*_*_*_*_*

*_*_*_*_*_*

*_*_*_*_*

*_*_*_*

*_*_*

*_*


1
Expert's answer
2021-12-11T10:00:46-0500


package pattern;


public class Pattern {


    
    public static void main(String[] args) {
        for(int i=10; i>=1; i--){
            for(int j=1; j<=i; j++){
                System.out.print("*");
            }
             System.out.println();
            for(int j=1; j<i; j++){
                System.out.print("-");
            }
            System.out.println();
        }
    }
    
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS