Skip to content

Instantly share code, notes, and snippets.

@m-stafford
Created August 15, 2016 19:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m-stafford/5655e473eb212bd3498658868d7254af to your computer and use it in GitHub Desktop.
Save m-stafford/5655e473eb212bd3498658868d7254af to your computer and use it in GitHub Desktop.
public class Counter {
public static void main(String[] args) {
int countFrom = 100;
int subBy = 1;
int iteration = 0;
int i = 0;
while (countFrom >= 0) {
if ((i + 1) % 10 == 0) {
iteration += 1;
}
System.out.println(countFrom);
countFrom = (countFrom - (subBy + iteration));
i += 1;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment