Write a code to generate a square pattern using the number '1'.
Input Description:
Given an integer R indicates number of rows.
Where 1<=R<=100.
Output Description:
Print the square pattern with the number '1' in R*R form based on the given integer R.
My Code is
let n = userInput[0];
let str = "";
for (let i=1; i<=n; i++) {
if (1<=n && n<=100) {
for (let j=1; j<=n; j++ ) {
str+=("1")
}
}
str+="\n"
}
console.log(str)
Sample Input :
5
Sample Output :
11111
11111
11111
11111
11111