Java ASCII Art letter V

Let’s try to create simple Java ASCII Art as letter V. Program which create letter V with 10 columns 20 rows

public class MainClass {
    public static void main(String[] args) throws InterruptedException {
        for(int i = 0; i < 10; i++)
        {
            for(int j = 0; j < 20; j++)
            {
                if( i == j )
                {
                    // make the left part of v
                    System.out.print("\\");
                }
                else if (j + i == 19)
                {
                    // make right part of the v
                    System.out.print("/");
                }
                else
                {
                    // fill the spaces
                    System.out.print(" ");
                }
            }
            Thread.sleep(250);
            // make new line
            System.out.println();
        }
    }
}

Output

\                  /
 \                / 
  \              /  
   \            /   
    \          /    
     \        /     
      \      /      
       \    /       
        \  /        
         \/         

Leave a Comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.