Posts

Showing posts from September, 2022

Printing Pattern With Java

  public static final String color_black = " \u001B [30m" ; public static final String reset = " \u001B [0m" ; int row = 11 ; int col = 15 ; int row_mid = row / 2 ; String [][] arr = new String [ row ][ col ]; for ( int i = 0 ; i < row ; i ++){ arr [ i ][ 0 ]= "****" ; } int j = 2 ; for ( int i = row_mid - 1 ; i >= 0 ; i --){ if ( j < col ){ arr [ i ][ j ]= "****" ; j = j + 3 ; } } int k = 2 ; for ( int i = row_mid + 1 ; i < row ; i ++){ if ( k < col ){ arr [ i ][ k ]= "****" ; k = k + 3 ; } } arr [ 5 ][ 3 ]= "*" ; int count = 6 ; while ( count <= 7 ){ for ( int i = 0 ; i < row ; i ++){ for ( int l = 0 ; l < col ; l ++){ if ( arr [ i ][ l ]== null ){ System . out . print ( color_black + "*" + reset ); } else { String str = " \u001B [9...

#Pattern with #java // How to print Pattern

public static final String color_black = " \u001B [30m" ; public static final String color_yellow = " \u001B [93m" ; public static final String color_blue = " \u001B [96m" ; public static final String reset = " \u001B [0m" ;   Patter One => int count = 0 ; for ( int i = 1 ; i <= 10 ; i ++){ for ( int j = i ; j <= 10 ; j ++){ System . out . print ( " " ); } for ( int j = 1 ; j <= i ; j ++){ if ( i % 2 == 0 ){ String str = " \u001B [3" + count + "m" + j + " " ; System . out . print ( str ); } else { System . out . print ( j + " " ); } } count ++; for ( int j = i ; j <= 10 ; j ++){ System . out . print ( " " ); } System . out . println (); }      Pattern Two => for ( int i = 0 ; i <= 10 ; i ++){ for ( int j = i ; j...

Text Color Change in Console

Image
Text  Color Change in Console => public static final String ANSI_RESET = " \u001B [0m" ; public static final String yellow = " \u001B [91m" ; public static final String ANSI_BLUE = " \u001B [96m" ; public static final String ANSI_WHITE = " \u001B [38m" ; public static final String ANSI_BLACK = " \u001B [30m" ; public static final String green = " \u001B [92m" ;     " \u001B [93m"            93 -- FG Code                                                      

Printing " F "using for Loop = = >

Image
class alphabet{ public static void main(String[] args) {         int row=12;         int col=26;         String[][]arr=new String[row][col];         arr[0][0]="*";         arr[1][col-1]="|";         arr[6][14]="|";         for (int i=1; i<row; i++){             arr[i][0]="|";         }         for (int i=1; i<col; i++){             if (i==col-1){                 arr[0][i]="*";             }        ...