Write a program to print the following formation depending upon size. Spaces at the starting of the line and spaces in between are important. Use System.out.println or System.out.print for printing.
Input (Integer) | Printed Ouput |
---|---|
4 | * |
5 | * |
6 | * |
class PrintFormation
{ public static void main(String s[])
{
printFormation(5);
}
public static void printFormation(int size)
{
//Write code here to print the required formation depending upon the size. Use System.out.println or System.out.print for printing.
}
}
Topic: Nested for Loop In Java