-
Notifications
You must be signed in to change notification settings - Fork 6
Docs: add 3 new pattern programs (Hollow Square, Diamond, Hollow Pyramid) — Refs #16 #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Docs: add 3 new pattern programs (Hollow Square, Diamond, Hollow Pyramid) — Refs #16 #24
Conversation
WalkthroughAdds six new C examples across two docs: three function-focused programs (GCD/LCM, perfect-number, strong-number) and three pattern generators (hollow square, diamond, hollow pyramid), each with full source, input handling, and expected output blocks. Changes
Sequence Diagram(s)sequenceDiagram
participant User as User (stdin)
participant Main as main()
participant Helper as Helper functions
participant Output as stdout
rect rgba(60,179,113,0.08)
User->>Main: provide input
Main->>Helper: call gcd/a/ lcm / sumOfProperDivisors / precomputeFactorials/isStrong
Helper-->>Main: return result
Main->>Output: print result (GCD/LCM, Perfect/Strong status, or pattern)
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
08_functions.md(1 hunks)21_pattern_examples.md(1 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
21_pattern_examples.md
261-261: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
262-262: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
263-263: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
264-264: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
264-264: Unordered list indentation
Expected: 2; Actual: 4
(MD007, ul-indent)
265-265: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
265-265: Unordered list indentation
Expected: 2; Actual: 4
(MD007, ul-indent)
266-266: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
267-267: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
267-267: Unordered list indentation
Expected: 2; Actual: 4
(MD007, ul-indent)
268-268: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
273-273: No space after hash on atx style heading
(MD018, no-missing-space-atx)
278-278: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
293-293: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
303-303: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
304-304: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
305-305: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
306-306: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
306-306: Unordered list indentation
Expected: 2; Actual: 4
(MD007, ul-indent)
307-307: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
307-307: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
308-308: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
308-308: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
309-309: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
309-309: Unordered list indentation
Expected: 2; Actual: 4
(MD007, ul-indent)
310-310: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
310-310: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
311-311: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
311-311: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
315-315: No space after hash on atx style heading
(MD018, no-missing-space-atx)
320-320: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
347-347: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
362-362: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
363-363: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
364-364: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
365-365: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
365-365: Unordered list indentation
Expected: 2; Actual: 4
(MD007, ul-indent)
366-366: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
366-366: Unordered list indentation
Expected: 2; Actual: 4
(MD007, ul-indent)
367-367: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
367-367: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
368-368: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
368-368: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
369-369: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
369-369: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
373-373: No space after hash on atx style heading
(MD018, no-missing-space-atx)
378-378: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
402-402: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
08_functions.md
206-206: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
207-207: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
208-208: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
209-209: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
210-210: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
210-210: Unordered list indentation
Expected: 2; Actual: 4
(MD007, ul-indent)
211-211: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
211-211: Unordered list indentation
Expected: 2; Actual: 4
(MD007, ul-indent)
212-212: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
213-213: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
214-214: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
217-217: No space after hash on atx style heading
(MD018, no-missing-space-atx)
242-242: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
248-248: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
249-249: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
250-250: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
251-251: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
252-252: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
252-252: Unordered list indentation
Expected: 2; Actual: 4
(MD007, ul-indent)
253-253: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
253-253: Unordered list indentation
Expected: 2; Actual: 4
(MD007, ul-indent)
254-254: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
255-255: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
256-256: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
259-259: No space after hash on atx style heading
(MD018, no-missing-space-atx)
281-281: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
290-290: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
291-291: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
292-292: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
293-293: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
294-294: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
294-294: Unordered list indentation
Expected: 2; Actual: 4
(MD007, ul-indent)
295-295: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
295-295: Unordered list indentation
Expected: 2; Actual: 4
(MD007, ul-indent)
296-296: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
297-297: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
298-298: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
301-301: No space after hash on atx style heading
(MD018, no-missing-space-atx)
323-323: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
| /* | ||
| * gcd_lcm_functions.c | ||
| * Demonstrates writing and reusing functions in C. | ||
| * | ||
| * What it shows: | ||
| * - Pure functions with clear inputs/outputs | ||
| * - Reuse: LCM computed using GCD | ||
| * | ||
| * Build: gcc gcd_lcm_functions.c -o gcd_lcm | ||
| * Run: ./gcd_lcm | ||
| */ | ||
| #include <stdio.h> | ||
| int gcd(int a, int b) { | ||
| while (b != 0) { | ||
| int r = a % b; | ||
| a = b; | ||
| b = r; | ||
| } | ||
| return (a < 0) ? -a : a; // handle negatives | ||
| } | ||
| long long lcm(int a, int b) { | ||
| int g = gcd(a, b); | ||
| // avoid overflow for small inputs by casting | ||
| return (long long)a / g * b; | ||
| } | ||
| int main(void) { | ||
| int x, y; | ||
| printf("Enter two integers: "); | ||
| if (scanf("%d %d", &x, &y) != 2) { | ||
| printf("Invalid input.\n"); | ||
| return 1; | ||
| } | ||
| printf("GCD(%d, %d) = %d\n", x, y, gcd(x, y)); | ||
| printf("LCM(%d, %d) = %lld\n", x, y, lcm(x, y)); | ||
| return 0; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
Align comment formatting with documentation standards.
The C code examples in this section use inconsistent formatting with raw markdown comments instead of embedding comments within fenced C code blocks. This violates MD007 and MD018 linting rules.
Restructure the three new examples (gcd_lcm_functions, perfect_number_function, strong_number_function) to place C-style comments inside the fenced code blocks, consistent with the repository's existing documentation:
-/*
- * gcd_lcm_functions.c
- * Demonstrates writing and reusing functions in C.
- *
- * What it shows:
- * - Pure functions with clear inputs/outputs
- * - Reuse: LCM computed using GCD
- *
- * Build: gcc gcd_lcm_functions.c -o gcd_lcm
- * Run: ./gcd_lcm
- */
-
#include <stdio.h>
+
+/*
+ * gcd_lcm_functions.c
+ * Demonstrates writing and reusing functions in C.
+ *
+ * Shows: Pure functions with clear I/O; LCM computed using GCD
+ * Build: gcc gcd_lcm_functions.c -o gcd_lcm
+ * Run: ./gcd_lcm
+ */Apply the same restructuring to the perfect_number_function.c and strong_number_function.c comments.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| /* | |
| * gcd_lcm_functions.c | |
| * Demonstrates writing and reusing functions in C. | |
| * | |
| * What it shows: | |
| * - Pure functions with clear inputs/outputs | |
| * - Reuse: LCM computed using GCD | |
| * | |
| * Build: gcc gcd_lcm_functions.c -o gcd_lcm | |
| * Run: ./gcd_lcm | |
| */ | |
| #include <stdio.h> | |
| int gcd(int a, int b) { | |
| while (b != 0) { | |
| int r = a % b; | |
| a = b; | |
| b = r; | |
| } | |
| return (a < 0) ? -a : a; // handle negatives | |
| } | |
| long long lcm(int a, int b) { | |
| int g = gcd(a, b); | |
| // avoid overflow for small inputs by casting | |
| return (long long)a / g * b; | |
| } | |
| int main(void) { | |
| int x, y; | |
| printf("Enter two integers: "); | |
| if (scanf("%d %d", &x, &y) != 2) { | |
| printf("Invalid input.\n"); | |
| return 1; | |
| } | |
| printf("GCD(%d, %d) = %d\n", x, y, gcd(x, y)); | |
| printf("LCM(%d, %d) = %lld\n", x, y, lcm(x, y)); | |
| return 0; | |
| } | |
| #include <stdio.h> | |
| /* | |
| * gcd_lcm_functions.c | |
| * Demonstrates writing and reusing functions in C. | |
| * | |
| * Shows: Pure functions with clear I/O; LCM computed using GCD | |
| * Build: gcc gcd_lcm_functions.c -o gcd_lcm | |
| * Run: ./gcd_lcm | |
| */ | |
| int gcd(int a, int b) { | |
| while (b != 0) { | |
| int r = a % b; | |
| a = b; | |
| b = r; | |
| } | |
| return (a < 0) ? -a : a; // handle negatives | |
| } | |
| long long lcm(int a, int b) { | |
| int g = gcd(a, b); | |
| // avoid overflow for small inputs by casting | |
| return (long long)a / g * b; | |
| } | |
| int main(void) { | |
| int x, y; | |
| printf("Enter two integers: "); | |
| if (scanf("%d %d", &x, &y) != 2) { | |
| printf("Invalid input.\n"); | |
| return 1; | |
| } | |
| printf("GCD(%d, %d) = %d\n", x, y, gcd(x, y)); | |
| printf("LCM(%d, %d) = %lld\n", x, y, lcm(x, y)); | |
| return 0; | |
| } |
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)
206-206: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
207-207: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
208-208: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
209-209: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
210-210: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
210-210: Unordered list indentation
Expected: 2; Actual: 4
(MD007, ul-indent)
211-211: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
211-211: Unordered list indentation
Expected: 2; Actual: 4
(MD007, ul-indent)
212-212: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
213-213: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
214-214: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
217-217: No space after hash on atx style heading
(MD018, no-missing-space-atx)
242-242: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
🤖 Prompt for AI Agents
In 08_functions.md around lines 205 to 245, the example uses raw markdown
comment syntax outside of the fenced C code block which violates MD007/MD018;
update the three examples (gcd_lcm_functions, perfect_number_function,
strong_number_function) so that each C example is entirely inside a ```c fenced
code block and contains C-style comments (/* ... */) at the top of the code
instead of markdown text outside the block; ensure the fence markers surround
only the C source, move any descriptive lines into C comments within the block,
and make the formatting consistent with existing repository examples.
gpl-gowthamchand
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey @Varunraj-53
Thanks for adding the pattern programs (Hollow Square, Diamond, Hollow Pyramid). The intent is clear and these examples will be useful for learners. Before we merge, please make a few small fixes to improve rendering and usability.
Requested changes (please update the PR when done)
-
Wrap each C program in fenced code blocks
- Replace the raw C text in the markdown with fenced blocks, for example (the example below shows the literal triple-backtick fence you should add):
```c
/* Hollow Square — pattern_hollow_square.c */
#include <stdio.h>
/* ... */
```
-
Correct the "Expected output" sections to match the code
- Example: the hollow-square code uses
n = 5, so the top/bottom row should show five stars. Please update the expected output blocks to match the program's behavior.
- Example: the hollow-square code uses
-
Fix the navigation links
- The Top/Bottom navigation at the top and bottom currently points to
21_pattern_examples.md(self). Please update Previous/Next links to the correct files.
- The Top/Bottom navigation at the top and bottom currently points to
-
(Recommended) Add runnable example files
-
Please add
.cexample files undercontributions/basic_programs/(orcontributions/tutorials/) for each pattern and link them from the markdown. Example filenames:contributions/basic_programs/pattern_hollow_square.ccontributions/basic_programs/pattern_diamond.ccontributions/basic_programs/pattern_hollow_pyramid.c
-
This makes it easier for learners to compile and run the examples.
-
-
Add a short header comment for each program
- Include Program name, Author, Date, Description, and Usage. Example:
/*
* Program: Hollow Square
* Author: [Your Name]
* Date: 2025-11-07
* Description: Print a hollow square pattern using nested loops
* Usage: gcc pattern_hollow_square.c -o hollow_square && ./hollow_square
*/-
Normalize output blocks and spacing
- Remove extra leading blank lines in expected output blocks and ensure consistent indentation.
Minor suggestions (optional)
- Add a one-line "Try it" section with a compile/run example for each program, e.g.:
gcc contributions/basic_programs/pattern_hollow_square.c -o hollow_square && ./hollow_square- Add a one-sentence link to the related lesson (loops) so learners know where to read more.
Why we ask you to make the fixes
- If you update the PR branch yourself, all new commits will be attributed to you. This is the cleanest way to ensure full recognition for your contribution.
- If you'd prefer maintainers to make the edits, we can do that and will add an explicit acknowledgement (see attribution options below). However, commit authorship will belong to whoever authored those commits.
How to make the changes (helpful commands)
Option A — Quick edit on GitHub (recommended for small doc fixes)
- Use the "Edit" button on
21_pattern_examples.mdin the PR, make edits, and commit. This updates the PR automatically and preserves your authorship.
Option B — Locally with git
# 1. Fetch and switch to the PR branch (example branch name used by PR)
git fetch origin pull/24/head:pr-24
git checkout pr-24
# 2. Make edits locally (wrap code fences, add .c files, fix outputs)
# 3. Stage and commit
git add 21_pattern_examples.md contributions/basic_programs/pattern_hollow_square.c \
contributions/basic_programs/pattern_diamond.c contributions/basic_programs/pattern_hollow_pyramid.c
git commit -m "docs: fix pattern examples — fenced code blocks, expected output, add runnable examples"
# 4. Push to the same branch (updates the PR)
git push origin pr-24Note: If your remote is your fork with a different name (e.g.,
originpoints to gpl-gowthamchand), push to the correct remote/branch used for the PR.
Attribution options if maintainers apply the fixes
- We can add a
Co-authored-by: Name <email>trailer to the maintainer commit to explicitly credit the contributor (this will appear in the commit message). Example:
Co-authored-by: Contributor Name <contrib@example.com>
Final note
Thanks again for the contribution, these pattern examples will help many learners practice nested loops. Please update the PR with the requested changes and ping me when it's ready; I’ll re-review and approve/merge once fixed.
If you'd like, I can make these edits for you and push them to this PR branch — I can include Co-authored-by lines to acknowledge you — but to maximize your credit it's best you push the changes yourself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
🧹 Nitpick comments (1)
21_pattern_examples.md (1)
259-291: Consider adding section headers for the new patterns.Patterns 1–7 each have a clear
## N. [Pattern Name]header for structure and navigation. The three new patterns (Hollow Square, Diamond, Hollow Pyramid) lack these headers, making them feel disconnected from the rest of the document.Adding headers like
## 8. Hollow Square Pattern,## 9. Diamond Pattern, and## 10. Hollow Pyramid Patternbefore each pattern's code section would improve consistency and readability.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
21_pattern_examples.md(3 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
21_pattern_examples.md
294-294: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
341-341: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
394-394: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
| **Expected output:** | ||
| ``` | ||
| * * * * * | ||
| * * | ||
| * * | ||
| * * | ||
| * * * * * | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add language specifier to expected output block to resolve MD040.
The expected output fence (line 294) is missing a language specifier. While the linter accepts an empty specifier, explicitly using output is clearer and complies with markdown-lint rules.
**Expected output:**
-```
+```output
* * * * *
* *
* *
* *
* * * * *
-```
+```🧰 Tools
🪛 markdownlint-cli2 (0.18.1)
294-294: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🤖 Prompt for AI Agents
In 21_pattern_examples.md around lines 293 to 300, the fenced block showing the
expected output is missing a language specifier which triggers MD040; update the
opening fence from ``` to ```output so the block becomes a fenced code block
with the language specifier "output" (leave the content lines unchanged and keep
the closing ``` intact).
| **Code:** | ||
| Runnable source: [contributions/basic_programs/pattern_diamond.c](../contributions/basic_programs/pattern_diamond.c) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove leading space before **Code:** for consistency.
Line 303 has an unintended leading space. Remove it to match the formatting of earlier patterns and line 259.
-**Code:**
+**Code:**
Runnable source: [contributions/basic_programs/pattern_diamond.c](../contributions/basic_programs/pattern_diamond.c)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| **Code:** | |
| Runnable source: [contributions/basic_programs/pattern_diamond.c](../contributions/basic_programs/pattern_diamond.c) | |
| **Code:** | |
| Runnable source: [contributions/basic_programs/pattern_diamond.c](../contributions/basic_programs/pattern_diamond.c) |
🤖 Prompt for AI Agents
In 21_pattern_examples.md around lines 303-304, there is an unintended leading
space before the "**Code:**" heading; remove that single leading space so the
line starts with "**Code:**" (no preceding whitespace) to match the formatting
used elsewhere (e.g., line 259).
| **Expected output:** | ||
| ``` | ||
| * | ||
| *** | ||
| ***** | ||
| ******* | ||
| ********* | ||
| ******* | ||
| ***** | ||
| *** | ||
| * | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add language specifier to expected output block to resolve MD040.
Same as the Hollow Square pattern: specify output as the language for the fence on line 341.
**Expected output:**
-```
+```output
*
***
*****
*******
*********
*******
*****
***
*
-```
+```🧰 Tools
🪛 markdownlint-cli2 (0.18.1)
341-341: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🤖 Prompt for AI Agents
In 21_pattern_examples.md around lines 340 to 351, the fenced code block showing
the Expected output lacks a language specifier and triggers MD040; update the
opening fence on line 341 to use ```output (i.e., change ``` to ```output) so
the block is explicitly marked as output and keep the closing fence as ``` to
match.
| **Code:** | ||
| Runnable source: [contributions/basic_programs/pattern_hollow_pyramid.c](../contributions/basic_programs/pattern_hollow_pyramid.c) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove leading space before **Code:** for consistency.
Line 355 has an unintended leading space. Remove it to match earlier patterns.
-**Code:**
+**Code:**
Runnable source: [contributions/basic_programs/pattern_hollow_pyramid.c](../contributions/basic_programs/pattern_hollow_pyramid.c)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| **Code:** | |
| Runnable source: [contributions/basic_programs/pattern_hollow_pyramid.c](../contributions/basic_programs/pattern_hollow_pyramid.c) | |
| **Code:** | |
| Runnable source: [contributions/basic_programs/pattern_hollow_pyramid.c](../contributions/basic_programs/pattern_hollow_pyramid.c) |
🤖 Prompt for AI Agents
In 21_pattern_examples.md around lines 355-356, there is an unintended leading
space before "**Code:**"; remove that single leading space so the line begins
with "**Code:**" to match the formatting of previous entries and keep
consistency across the document.
|
Hi @Varunraj-53, thanks for cleaning up the pattern examples and fixing the code blocks, that’s great! One quick request before we merge: instead of embedding the full C programs inside the course markdown, could you add each program as a separate Suggested filenames:
Please add a short header comment to each file with Program, Author (your name), Date, Description, and Usage (compile/run). After you push those files to this branch, I’ll re-review and merge. If you prefer I can add the files for you and push them to this branch (I’ll include a |
This pull request adds three new pattern programs with detailed explanations inside the code:
• Hollow Square Pattern
• Diamond Star Pattern
• Hollow Pyramid Pattern
These examples follow the repository's formatting style and are placed in 21_pattern_examples.md.
Refs #16.
Summary by CodeRabbit