Learn Programming through Logical Thinking Series – 6

Learn Programming through Logical Thinking Series – 6

This blog explains about Learn Programming through Logical Thinking Series – 6 . It is explained below :

_______________________________________________________________________________

 

Today, we are going to learn about Pattern Programs here.  The given pattern to be printed is

4444
333
22
1

_______________________________________________________________________________

                              Logical thinking is the main part of programming. If you are a programmer, then it is important to have good logical thinking skills. So, how could you improve your logical thinking skills? Let’s find out.

1. The conditional statement

Programming is more about conditions and looping. To improve logical thinking, start to think conditionally such as Yes or No, True or False. Try to question yourself or solve problem as a conditional statement such as if…then else… it’s very helpful to improve your conditional reasoning power.

2. Think like a machine

The machine didn’t understand anything because it works on the instruction which we gave. To solve a problem, give instructions and try to follow the order. Here, instructions are nothing but a logic. Machine oriented thinking will help you to write logic in a program.

3. Solve logic puzzles

Try to solve riddles and puzzles from newspaper or in modern mobile app. Don’t get disheartened if you can’t solve them at first attempt or take a long time to solve them. Remember that you are in the process of learning and improving skills. Your brain will be trained to think differently with every puzzle that you try to solve.

_______________________________________________________________________________________

 

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

____________________________________________________________________

REFERENCES : 

https://payilagam.com/wp-admin/post.php?post=13280&action=edit