- 2
FizzBuzz returns
Write a segment of code that ask the user for a number greater than 0 to specify an upper bound . use a while loop to validate that the user inputs such a number .Then for each number from 0 to the upper bound, inclusive print that number .if the number is divisible by 3 print fizz. if the number is divisible by 5 print Buzz. if the number by both print FizzBuzz .Make sure the number and the appropriate FizzBuzz message is printed on one line and that each number is printed on a new line.
2 Réponses
0
What is your question?
If you need help with the task: Start by getting user input in a while loop. Check if the number is > 0, if yes: break from the loop.
Then create a loop that iterates from 0 to the input number. In this loop, check the divisibility on each iteration and output accordingly.
Please link your code attempt, if you want us to check on it.
0
Read over modulus operator material. That will help when dividing.