Write a program to print the diamond shape using asterisk (star)(*
). The size should be dependent on the input number. Use System.out.println or System.out.print for printing.
Input (Integer) | Print Formation |
---|---|
3 | *
|
5 | *
|
6 | *
|
class PrintDiamondWithStars
{ public static void main(String s[])
{
printDiamondWithStars(5);
}
public static void printDiamondWithStars(int input)
{
//Write code here to print the diamond shape with stars.
}
}
Topic: Nested for Loop In Java