Created
September 23, 2021 21:36
-
-
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
This file contains 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
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