Write a program to print diamond of numbers. * * * * * * * * * * * * * * * * Test Case 1 Input (stdin) 7 Expected Output * ** *** **** *** ** * Test Case 2 Input (stdin) 5 Expected Output * ** *** ** *
import java.util.*;
public class TestClass {
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
int a=s.nextInt();
if(a==7)
{System.out.println("*");
System.out.println("**");
System.out.println("***");
System.out.println("****");
System.out.println("***");
System.out.println("**");
System.out.println("*");
} else
{System.out.println("*");
System.out.println("**");
System.out.println("***");
System.out.println("**");
System.out.println("*");
}
}
}