Skip to content

Commit ef30c9f

Browse files
authored
Adding a tutorial for dimik-box-1 (#477)
* Adding a tutorial for dimik-box-1 * Update en.md * Update en.md
1 parent 6b3677f commit ef30c9f

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

dimik-box-1/en.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Dimik - Box 1
2+
3+
In this problem, you will be given `T` testcases. Each line of the testcase consists of an integer `n`. We just have to print `*` in `n` rows and `n` columns.
4+
5+
### Solution
6+
We can find the solution by running two nested loops. We run the outermost loop for each row and for each row we run the innermost loop for each column. The thing to observe here is we print an empty line between consecutive test cases. So there will be no empty lines after last test case.
7+
8+
### C++
9+
```cpp
10+
#include <bits/stdc++.h>
11+
using namespace std;
12+
int main()
13+
{
14+
int t;
15+
cin >> t;
16+
for (int k = 1; k <= t; k++)
17+
{
18+
int n;
19+
cin >> n;
20+
for (int i = 1; i <= n; i++)
21+
{
22+
for (int j = 1; j <= n; j++)
23+
cout << "*";
24+
cout << endl;
25+
}
26+
if(k!=t) cout << endl;
27+
}
28+
}
29+
```

0 commit comments

Comments
 (0)