Jump to content

Featured Replies

Posted

Let's start with a classic!
I wanted to create a simple challenge for kids or beginners just starting out with programming. FizzBuzz is one of the most basic challenges you'll encounter, but it's also a great way to practice loops and conditions.

Hint: You can only % so much... after that, it’s all about $. 😉

Have fun coding, and don’t forget to share your twist on the solution!

Write a program that implements the classic FizzBuzz game with an additional twist:

Basic Requirements:

  1. For numbers from 1 to 100:

    • Print "Fizz" if the number is divisible by 3.

    • Print "Buzz" if the number is divisible by 5.

    • Print "FizzBuzz" if the number is divisible by both 3 and 5.

    • Print the number if none of the above conditions are met.

Bonus Twist Features:

  • Allow the user to input the range of numbers to check.

  • Add a new condition:

    • Print "Bazz" if the number is divisible by 7.

    • Combine outputs for numbers divisible by multiple conditions (e.g., 21 would print "FizzBazz").

Example Output:

Enter the starting number: 1
Enter the ending number: 50

1
2
Fizz
4
Buzz
Fizz
Bazz
8
Fizz
Buzz
11
Fizz
13
Bazz
FizzBuzz
  • Views 97
  • Created
  • Last Reply

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Important Information

Terms of Use Privacy Policy Guidelines We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.