Created
July 9, 2021 09:03
-
-
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.
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
| 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