Skip to content

Add Fraction Math in Modula2 #4520

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

Closed
wants to merge 6 commits into from
Closed

Conversation

bellxalli
Copy link

@bellxalli bellxalli commented Feb 18, 2025

Congrats on taking the first step to contributing to the Sample Programs repository maintained by The Renegade Coder!
For simplicity, please make sure that your pull request includes one and only one contribution.

Please fill one of the sections below as applicable.
Please also add any other relevant information to the Notes section at the bottom.
You may delete or just ignore any other sections.
For more information please refer to our contributing documentation

I Am Adding a New Code Snippet in an Existing Language

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Hey @bellxalli! Thanks for contributing to this project! We are a rather small team, so it may take some time to process this request. In the meantime, there are several ways you can make yourself a part of The Renegade Coder community. For instance, you can:

Thanks for your help!

@rzuckerm rzuckerm changed the title Add FractionMath in modula2 Add FractionMath in Modula2 Feb 18, 2025
Comment on lines +36 to +46
PROCEDURE Reduce(n, d : INTEGER);
BEGIN
IF d = 0 THEN
WriteString("error cannot divide by 0");

ELSE
gcd := GreatestCommonDenominator(n, d);
numerator := n / gcd;
denominator := d / gcd;
END;
END Reduce;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Seems like this procedure is never used. There is a lot of code duplication where this could have been used. I'd recommend just making this part of SetFraction

END;
END result;

BEGIN
Copy link
Collaborator

Choose a reason for hiding this comment

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

Command line arguments are used for inputs, and stdout is used for outputs for all samples. Please see the project requirements for details.

@rzuckerm rzuckerm changed the title Add FractionMath in Modula2 Add Fraction Math in Modula2 Feb 18, 2025
@rzuckerm rzuckerm added enhancement Any code that improves the repo fraction math See: https://sampleprograms.io/projects/fraction-math/ labels Feb 24, 2025
@rzuckerm
Copy link
Collaborator

Closed due to a month of inactivity

@rzuckerm rzuckerm closed this Mar 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Any code that improves the repo fraction math See: https://sampleprograms.io/projects/fraction-math/
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Fraction Math in Modula2
2 participants