Skip to content

fix: correct loop to print affirmation 50 times instead of 51 #4

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tanvikreddy123
Copy link

This commit addresses an off-by-one error in the loop condition within 18-affirmations.java.
The original loop used i <= 50, resulting in 51 iterations due to zero-based indexing (i starting at 0).
By updating the condition to i < 50, the loop executes exactly 50 times, aligning with the intended behavior of printing the affirmation fifty times.

This correction enhances the accuracy of the program and ensures compliance with the exercise requirements.

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