Docs: add 3 function examples (GCD & LCM, Perfect, Strong) — Refs #16#25
Docs: add 3 function examples (GCD & LCM, Perfect, Strong) — Refs #16#25Varunraj-53 wants to merge 1 commit intogpl-gowthamchand:masterfrom
Conversation
WalkthroughAdded three complete C program code blocks to documentation: gcd_lcm_functions.c (GCD and LCM calculations), perfect_number_function.c (perfect number detection), and strong_number_function.c (strong number validation using precomputed factorials). Each includes functions, input validation, computation logic, and formatted output. Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant GCD as gcd_lcm<br/>program
participant Perfect as perfect_number<br/>program
participant Strong as strong_number<br/>program
rect rgb(200, 220, 255)
Note over GCD: Input → GCD/LCM → Output
User->>GCD: Enter 2 integers
activate GCD
GCD->>GCD: Compute gcd()
GCD->>GCD: Compute lcm()
GCD-->>User: Display results
deactivate GCD
end
rect rgb(200, 220, 255)
Note over Perfect: Input → Check divisors → Output
User->>Perfect: Enter number
activate Perfect
Perfect->>Perfect: sumOfProperDivisors()
Perfect->>Perfect: Compare with input
Perfect-->>User: Perfect/Imperfect
deactivate Perfect
end
rect rgb(200, 220, 255)
Note over Strong: Precompute → Input → Check → Output
Strong->>Strong: precomputeFactorials()
User->>Strong: Enter number
activate Strong
Strong->>Strong: isStrong() checks<br/>digit factorials
Strong-->>User: Strong/Not Strong
deactivate Strong
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)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🪛 markdownlint-cli2 (0.18.1)08_functions.md206-206: Unordered list indentation (MD007, ul-indent) 207-207: Unordered list indentation (MD007, ul-indent) 208-208: Unordered list indentation (MD007, ul-indent) 209-209: Unordered list indentation (MD007, ul-indent) 210-210: Unordered list indentation (MD007, ul-indent) 210-210: Unordered list indentation (MD007, ul-indent) 211-211: Unordered list indentation (MD007, ul-indent) 211-211: Unordered list indentation (MD007, ul-indent) 212-212: Unordered list indentation (MD007, ul-indent) 213-213: Unordered list indentation (MD007, ul-indent) 214-214: Unordered list indentation (MD007, ul-indent) 217-217: No space after hash on atx style heading (MD018, no-missing-space-atx) 242-242: Code block style (MD046, code-block-style) 248-248: Unordered list indentation (MD007, ul-indent) 249-249: Unordered list indentation (MD007, ul-indent) 250-250: Unordered list indentation (MD007, ul-indent) 251-251: Unordered list indentation (MD007, ul-indent) 252-252: Unordered list indentation (MD007, ul-indent) 252-252: Unordered list indentation (MD007, ul-indent) 253-253: Unordered list indentation (MD007, ul-indent) 253-253: Unordered list indentation (MD007, ul-indent) 254-254: Unordered list indentation (MD007, ul-indent) 255-255: Unordered list indentation (MD007, ul-indent) 256-256: Unordered list indentation (MD007, ul-indent) 259-259: No space after hash on atx style heading (MD018, no-missing-space-atx) 281-281: Code block style (MD046, code-block-style) 290-290: Unordered list indentation (MD007, ul-indent) 291-291: Unordered list indentation (MD007, ul-indent) 292-292: Unordered list indentation (MD007, ul-indent) 293-293: Unordered list indentation (MD007, ul-indent) 294-294: Unordered list indentation (MD007, ul-indent) 294-294: Unordered list indentation (MD007, ul-indent) 295-295: Unordered list indentation (MD007, ul-indent) 295-295: Unordered list indentation (MD007, ul-indent) 296-296: Unordered list indentation (MD007, ul-indent) 297-297: Unordered list indentation (MD007, ul-indent) 298-298: Unordered list indentation (MD007, ul-indent) 301-301: No space after hash on atx style heading (MD018, no-missing-space-atx) 323-323: Code block style (MD046, code-block-style) 🔇 Additional comments (1)
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 |
gpl-gowthamchand
left a comment
There was a problem hiding this comment.
Hi @Varunraj-53, thanks again for these useful function examples! They’ll help learners a lot.
Before we merge, could you make a few small changes so the examples are easier to run and the lesson remains lean?
Requested changes:
-
Move each program to its own file under
contributions/basic_programs/:contributions/basic_programs/gcd_lcm_functions.ccontributions/basic_programs/perfect_number_function.ccontributions/basic_programs/strong_number_function.c
-
Add a small header comment to each file with Program, Author, Date, Description, and Usage (compile/run example).
-
In
08_functions.mdkeep a short example or link to each.cfile instead of embedding the full program inline. -
Push the changes to this PR branch once done so authorship is preserved.
If you'd prefer, I can make these changes for you and push them to this branch; I will add a Co-authored-by line to credit you. However, to maximize visible credit it’s best if you push the updates.
Thanks.. ping me when done and I’ll re-review quickly.
This pull request adds three new function-based C programs to the file
08_functions.md.Each example includes clear explanations inside the code comments and follows the existing formatting style.
✅ Added Programs:
GCD & LCM Using Functions
Perfect Number Function
Strong Number Function
✅ Why this improves the repository:
Refs #16.
Summary by CodeRabbit