Skip to content

Add return on investment to math#1580

Open
InukaWijerathna wants to merge 1 commit into
TheAlgorithms:masterfrom
InukaWijerathna:add/return-on-investment
Open

Add return on investment to math#1580
InukaWijerathna wants to merge 1 commit into
TheAlgorithms:masterfrom
InukaWijerathna:add/return-on-investment

Conversation

@InukaWijerathna
Copy link
Copy Markdown

Description

Adds return_on_investment to the math/ directory.

ROI is a basic but important financial calculation that tells you how profitable an investment was:

ROI = (Gain - Cost) / Cost × 100

What's included

  • math/return_on_investment.c — implementation with Doxygen-style docs, assert-based self-tests, and graceful error handling for invalid input

Checklist

  • Follows the code style of the project (Doxygen comments, assert tests, main() test runner)
  • Handles invalid input (zero/negative cost) with stderr message and sentinel return value
  • Self-contained with all tests in main()

Reference: https://www.investopedia.com/terms/r/returnoninvestment.asp

@InukaWijerathna
Copy link
Copy Markdown
Author

InukaWijerathna commented Jun 5, 2026

Closing this for now — needs more work on my end before it's ready.

@InukaWijerathna
Copy link
Copy Markdown
Author

Hi! Just checking in to see if there's any update on this PR — happy to make any changes needed to get it merged. Thanks for your time!

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.

1 participant