Today, we are going to learn about Pattern Programs here. The given pattern to be printed is
4444
333
22
1
PATTERN PROGRAM
package task.my.pro;
public class PatternProgram{
public static void main(String[] args) {
int no=4,round=0;
do{
int column=0,row=0;
while(column<4-round)
{
//Printing no value below
System.out.print(no);
column++;
}
no–;
// Moving to next line
System.out.println(” “);
round++;
do
{
System.out.print(” “);
row++;
}while(row<round);
}while(round<4);
}
}
OUTPUT
4444
333
22
1