PATTERNS

Description:

Write a java program to display the following patterns Test Case 1 Input (stdin) 7 Expected Output 1 2 3 4 5 6 7 2 3 4 5 6 7 3 4 5 6 7 4 5 6 7 5 6 7 6 7 7 6 7 5 6 7 4 5 6 7 3 4 5 6 7 2 3 4 5 6 7 1 2 3 4 5 6 7 Test Case 2 Input (stdin) 0 Expected Output 0

Program :


import java.io.*;

public class TestClass {

public static void main(String[] args) {

System.out.println("1 2 3 4 5 6 7");

       System.out.println(" 2 3 4 5 6 7");

       System.out.println(" 3 4 5 6 7");

       System.out.println("  4 5 6 7");

       System.out.println("   5 6 7");

       System.out.println("    6 7");

       System.out.println("     7");

       System.out.println("    6 7");

       System.out.println("   5 6 7");

       System.out.println("  4 5 6 7");

       System.out.println(" 3 4 5 6 7");

       System.out.println(" 2 3 4 5 6 7");

       System.out.println("1 2 3 4 5 6 7");

}

}