Skip to content

Instantly share code, notes, and snippets.

@McLarenCollege
Last active October 20, 2021 10:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save McLarenCollege/50f0d1ab1c0930c3fbc2cbf3a57880f6 to your computer and use it in GitHub Desktop.
Save McLarenCollege/50f0d1ab1c0930c3fbc2cbf3a57880f6 to your computer and use it in GitHub Desktop.
Exercise : Print Pattern Rows : While loop

Given the number of rows, use a while loop to print the following pattern.

For rows = 2, the pattern should print like this:
*
**
For rows = 4, the pattern should print like this:
*
**
***
****

rows will always be a positive integer.

function printPattern(rows){
// write your code here
}
printPattern(2);
printPattern(4);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment