For my class we need to create an Ascii drawing with at least 3 nested loops and 3 different type of loops. this is what i have so far ( just 2 lines of the drawing)

for(int i = 0; i<=4; i++)
    {
        System.out.print("0");
    }
    for(int i = 0; i<=13; i++)
    {
        System.out.print("|");
    }
    for(int i = 0; i<=4; i++)
    {
        System.out.print("0");
    }
    for(int i = 0; i<=10; i++)
    {
        System.out.print("|");
    }
    for(int i = 0; i<=16; i++)
    {
        System.out.print("8");
    }
    for(int i = 0; i<=2; i++)
    {
        System.out.print("|");
    }
    for(int i = 0; i<=13; i++)
    {
        System.out.print("p");
    }

How exactly can I make this either shorter or have a nested loop or a different type of loop?

It didnt paste everything so this is the updated version!

public class AsciiArt 
{
    public static void main(String[] args)
    {
        System.out.print("  ");
    for(int i = 0; i<=4; i++)
    {
        System.out.print("0");
    }
    for(int i = 0; i<=13; i++)
    {
        System.out.print("|");
    }
    for(int i = 0; i<=4; i++)
    {
        System.out.print("0");
    }
    for(int i = 0; i<=10; i++)
    {
        System.out.print("|");
    }
    for(int i = 0; i<=16; i++)
    {
        System.out.print("8");
    }
    for(int i = 0; i<=2; i++)
    {
        System.out.print("|");
    }
    for(int i = 0; i<=13; i++)
    {
        System.out.print("p");
    }



    //second line
    System.out.print("\n");
    for(int i = 0; i<=8; i++)
    {
        System.out.print("0");
    }
    for(int i = 0; i<=9; i++)
    {
        System.out.print("|");
    }
    for(int i = 0; i<=8; i++)
    {
        System.out.print("0");
    }
    for(int i = 0; i<=8; i++)
    {
        System.out.print("|");
    }
    for(int i = 0; i<=15; i++)
    {
        System.out.print("8");
    }
    for(int i = 0; i<=2; i++)
    {
        System.out.print("|");
    }
    for(int i = 0; i<=14; i++)
    {
        System.out.print("p");
    }
}
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.