Skip to content

Conversation

@Varunraj-53
Copy link

@Varunraj-53 Varunraj-53 commented Nov 6, 2025

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

  • New Features
    • Added three new mathematical examples demonstrating function composition, modular helpers, input validation, and numeric algorithms (GCD/LCM, perfect numbers, strong number checks).
    • Added three geometric pattern examples (hollow square, diamond, hollow pyramid) with runnable code, explanations, and expected output for learning and verification.
  • Documentation
    • Updated navigation flow by adjusting lower navigation links.

@coderabbitai
Copy link

coderabbitai bot commented Nov 6, 2025

Walkthrough

Adds 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

Cohort / File(s) Summary
Function Demonstrations
08_functions.md, gcd_lcm_functions.c, perfect_number_function.c, strong_number_function.c
Adds three standalone C programs: gcd_lcm_functions.c (adds int gcd(int,int) and long long lcm(int,int), main reads input, prints GCD/LCM with negative/overflow handling), perfect_number_function.c (adds int sumOfProperDivisors(int), main validates input and checks perfect numbers), and strong_number_function.c (adds void precomputeFactorials(void), int isStrong(int), global factorial table, main tests Strong Numbers). All are additive, modular helper functions with input validation.
Pattern Generation Examples
21_pattern_examples.md
Adds three pattern examples with runnable source and expected outputs: Hollow Square Pattern, Diamond Pattern, and Hollow Pyramid Pattern. Each entry includes full code (nested loops), inline comments, and explicit "Expected output" blocks. Also adjusts bottom navigation links (removed/changed Next link occurrences).

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
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Extra attention:
    • gcd_lcm_functions.c: LCM uses long long — verify overflow mitigation and negative input handling.
    • strong_number_function.c: confirm factorial precompute correctness and bounds (0..9).
    • perfect_number_function.c: verify divisor-summing edge cases (n<=1) and output formatting.
    • 21_pattern_examples.md: ensure expected output blocks match printed whitespace/newline formatting.

Poem

🐰 I hopped through C, one line at a time,

gcd and lcm, numbers in rhyme;
patterns drawn with loops so light,
factorials prepped for a strong-number fight;
I nibble bugs and celebrate code tonight. 🥕

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Docs: add 3 new pattern programs (Hollow Square, Diamond, Hollow Pyramid) — Refs #16' directly and specifically summarizes the main change: adding three new pattern programs to documentation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between 3ca0741 and 809a2ae.

📒 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)

Comment on lines +205 to +245
/*
* 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;
}
Copy link

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.

Suggested change
/*
* 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.

Copy link
Owner

@gpl-gowthamchand gpl-gowthamchand left a 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)
  1. 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>
/* ... */
```
  1. 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.
  2. 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.
  3. (Recommended) Add runnable example files

    • Please add .c example files under contributions/basic_programs/ (or contributions/tutorials/) for each pattern and link them from the markdown. Example filenames:

      • contributions/basic_programs/pattern_hollow_square.c
      • contributions/basic_programs/pattern_diamond.c
      • contributions/basic_programs/pattern_hollow_pyramid.c
    • This makes it easier for learners to compile and run the examples.

  4. 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
 */
  1. 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.md in 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-24

Note: If your remote is your fork with a different name (e.g., origin points 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.

Copy link

@coderabbitai coderabbitai bot left a 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 Pattern before each pattern's code section would improve consistency and readability.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 809a2ae and 9b139c2.

📒 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)

Comment on lines +293 to +300
**Expected output:**
```
* * * * *
* *
* *
* *
* * * * *
```
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

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).

Comment on lines +303 to +304
**Code:**
Runnable source: [contributions/basic_programs/pattern_diamond.c](../contributions/basic_programs/pattern_diamond.c)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

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.

Suggested change
**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).

Comment on lines +340 to +351
**Expected output:**
```
*
***
*****
*******
*********
*******
*****
***
*
```
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

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.

Comment on lines +355 to +356
**Code:**
Runnable source: [contributions/basic_programs/pattern_hollow_pyramid.c](../contributions/basic_programs/pattern_hollow_pyramid.c)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

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.

Suggested change
**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.

@gpl-gowthamchand
Copy link
Owner

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 .c file under contributions/basic_programs/ and keep only a short snippet or a link in 21_pattern_examples.md? This helps keep the learning pages lean and lets learners download/compile the examples easily.

Suggested filenames:

  • contributions/basic_programs/pattern_hollow_square.c
  • contributions/basic_programs/pattern_diamond.c
  • contributions/basic_programs/pattern_hollow_pyramid.c

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 Co-authored-by line), but it’s best if you push the files so you keep full commit authorship. Thanks again — this looks useful for learners!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants