Algorithm To Print A Square Pattern

Princy Prakash
May 25, 2023

--

ALGORITHM:

  1. Get the input n, which is the number of rows and columns in the pattern.
  2. Initialize two loops, one for columns and one for rows.
  3. Set the variable i to 0 and repeat until i < n.
  4. Set the variable j to 0 and repeat until j < n.
  5. Within the inner loop, print a star symbol.
  6. Increment j by 1 to move to the next column.
  7. After the inner loop completes, create a new line to move to the next row.
  8. Increment i by 1 to move to the next row.
  9. Once both loops complete, the square pattern of stars will be printed.

CONCLUSION:

In conclusion, the algorithm to print a square pattern of stars is a straightforward process that involves using two nested loops to iterate over the rows and columns of the pattern.

FLOWCHART:

--

--

Princy Prakash
Princy Prakash

Written by Princy Prakash

Hi I Am Princy. I recently discovered my passion for programming and excited to get deeper into the world of technologies also in problem-solving

No responses yet