Skip to content

Instantly share code, notes, and snippets.

@tayormi
Created July 9, 2021 09:03
Show Gist options
  • Select an option

  • Save tayormi/7c408ac670d8f1c055e2676be42ce450 to your computer and use it in GitHub Desktop.

Select an option

Save tayormi/7c408ac670d8f1c055e2676be42ce450 to your computer and use it in GitHub Desktop.
Dart program that prints each number from 1 to 100 on a new line.
void main() {
// Function to print numbers from 1 to 100, display Bud when in multiples of 3
// Display Vue when in multiples of 5
// Display "Budvue should consider $yourName for this position" when in multiples of both 3 and 5
printNumbers(1, 100);
}
void printNumbers(int start, int end) {
var yourName = "Temitope Ajiboye";
for (var i = start; i <= end; i++) {
//show mutliples of 3
if (i % 3 == 0) {
print('Bud');
}
//show multiples of 5
if (i % 5 == 0) {
print('Vue');
}
// show multiples of 3 and 5
if (i % 3 == 0 && i % 5 == 0) {
print('"Budvue should consider $yourName for this position"');
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment