Skip to content

Instantly share code, notes, and snippets.

@FernandoAntonio
Created September 23, 2021 21:36
Show Gist options
  • Save FernandoAntonio/418ed86c93500908c97630cae5f71edf to your computer and use it in GitHub Desktop.
Save FernandoAntonio/418ed86c93500908c97630cae5f71edf to your computer and use it in GitHub Desktop.
Prints from 1 to 100, but multiples of 3, 5, and 3 and 5 simultaneously being exceptions
void main() {
final String bud = 'Bud';
final String vue = 'Vue';
final String username = 'Fernando Antonio';
bool isMultipleOfThree(int number) => (number % 3 == 0);
bool isMultipleOfFive(int number) => (number % 5 == 0);
for (var i = 1; i <= 100; i++) {
if (isMultipleOfThree(i) && isMultipleOfFive(i)) {
print('$bud${vue.toLowerCase()} should consider $username for this position');
} else if (isMultipleOfThree(i)) {
print(bud);
} else if (isMultipleOfFive(i)) {
print(vue);
} else {
print(i);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment