Loops and function basics

Que 1:
Write a function to render the following pattern in the console:

* * * * *
* * * *
* * *
* * 
*

The function needs to take a number as a parameter which represents how many asterisks are rendered on the first row.

Ans: