Skip to content

Add return on investment to maths#263

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

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

Conversation

@InukaWijerathna

Copy link
Copy Markdown

Description

Adds returnOnInvestment to the maths/ directory.

Return on Investment (ROI) is a straightforward financial formula that measures how profitable an investment was relative to what you put in:

ROI = (Gain - Cost) / Cost × 100

What's included

  • maths/return_on_investment.dart — typed function with doc comment, throws ArgumentError for non-positive cost, includes a main() with example outputs

Checklist

  • Follows the code style of the project
  • Throws ArgumentError for invalid input
  • Includes main() with sample outputs

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

@InukaWijerathna

InukaWijerathna commented Jun 5, 2026

Copy link
Copy Markdown
Author

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!

@akashgkrishnan akashgkrishnan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Add tests.

Add the question.

Use named variables for readability
Handle edge cases

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