I need help with nested while loops

User Generated

uctnyy

Programming

Description

I need help printing triangles with "*" and " " with nested while loops, but no for loops. I understand that I can change the for loops into while loops, but I am having difficulty creating  boolean method required by the specs of the project.

User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

Thank you for the opportunity to help you with your question!

you can find the below mentioned method 


/**
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package loop;

/**
 *
 * @author ACHCHUTHAN
 */
public class Pyramids {

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

}

Please let me know if you need any clarification. I'm always happy to answer your questions.


Anonymous
Excellent! Definitely coming back for more study materials.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Related Tags