Solve Any Pattern Question Using This Trick!
Program: public class Patterns { public static void main ( String [] args ) { pattern7 ( 4 ); } /*pattern1 * * * * * * * * * * * 4 rows and 4 column */ static void pattern1 ( int n ) { for ( int i = 1 ; i <= n ; i ++ ) { // i is row for ( int j = 1 ; j <= i ; j ++ ) { // j is row System . out . print ( "* " ); } System . out . println (); } } /*pattern2 * * * * * * * * * * * * * * * * 4 rows and 4 column*/ static void pattern2 ( int n ) { for ( int i = 1 ; i <= n ; i ++ ) { // i is row for ( int j = 1 ; j <= n ; j ++ ) { // j is row System . out . print ( "* " ); } System . out . println (); } } /*pattern3 * * * * * * * * * * 4 rows and 4 column*/ static void pattern3 ( int n ) { for ( int i ...