Lua program | Sololearn: Learn to code for FREE!
+ 1

Lua program

Given a number NN, generate a star pattern such that on the first line there are NNstars and on the subsequent lines the number of stars decreases by 1. The pattern generated should have NN rows. In every row, every fifth star (*) is replaced with a hash (#). Every row should have the required number of stars (*) and hash (#) symbols. The code stub provided here is to be used. It calls the function generatePattern(). Your task is to complete the function. Input: First line will contain TT, number of testcases. Then the testcases follow. Each testcase contains a single integer NN Output: For each testcase, print the star and hash pattern. Constraints 1≤T≤251≤T≤25 1≤N≤1001≤N≤100 Subtasks Subtask #1 (40 points): N≤15N≤15 Subtask #2 (60 points): original constraints

18th Oct 2020, 3:14 PM
Kangude Harshada Bhimraj
2 Answers
+ 2
Not many Lua programmers on Sololearn
18th Oct 2020, 10:22 PM
Sonic - avatar
21st Sep 2022, 4:10 PM
Karthik G
Karthik G - avatar