Created
October 2, 2012 00:41
-
-
Save RyanScottLewis/3815497 to your computer and use it in GitHub Desktop.
Even Number Printing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int limit = 100; | |
| // moop through each number from 1 to the limit (100) | |
| for(int i=1; i <= limit; i++){ | |
| // everything in this block of code will be ran for each number | |
| // if the number is divisible by 2 then it is even | |
| if (i % 2 == 0) { | |
| // print out the number with a space after it | |
| System.out.print(i + " "); | |
| } | |
| // if the number is divisible by 10 then it is 10, 20, 30, etc.. | |
| if (i % 10 == 0) { | |
| // print out a new line | |
| System.out.print("\n"); | |
| // print out the bar | |
| System.out.print("================"); | |
| // print out another new line | |
| System.out.print("\n"); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment