Write a program to print the following formation depending upon the size. Use System.out.println or System.out.print for printing.
Input (Integer) | Output |
---|---|
5 | _ _ _ _ |
6 | _ _ _ _ _ |
8 | _ _ _ _ _ _ _ |
class PrintInvertedTriangleShape
{ public static void main(String s[])
{
printFormation(5);
}
public static void printFormation(int columnsSize)
{
//Write code here to print the required formation depending upon the columnsSize. Use System.out.println or System.out.print for printing.
}
}
Topic: Nested for Loop In Java