Discover answers to your questions with Westonci.ca, the leading Q&A platform that connects you with knowledgeable experts. Get quick and reliable solutions to your questions from knowledgeable professionals on our comprehensive Q&A platform. Get detailed and accurate answers to your questions from a dedicated community of experts on our Q&A platform.

Given a number n, for each integer i in the range from 1 to n inclusive, print one value per line as follows:

• Ifi is a multiple of both 3 and 5, print FizzBuzz.
• If iis a multiple of 3(but not 5), print Fizz.
• Ifi is a multiple of 5(but not 3), print Buzz.
• If i is not a multiple of 3 or 5, print the value of i.​


Sagot :

The program is an illustration of loops and conditional statements

Loops

Loops are used to perform repetitive operations

Conditional statements

Conditional statements are statements that are used to make decisions, depending on their truth values

Python program

The program written in Python where comments are used to explain each line is as follows:

#This gets input for n

n = int(input())

#This iterates through n

for i in range(1,n+1):

   #If the current number is not a multiple of 3 and 5

   if not(i%3 == 0 or i%5==0):

       #This prints the number

       print(i,end="")

   else:

       #This prints "Fizz", if the current number is a multiple of 3

       if i%3 == 0:

           print("Fizz",end="")

       #This prints "Buzz", if the current number is a multiple of 5

       if i%5==0:

           print("Buzz",end="")

   #This prints a new line

   print()

Read more about loops and conditional statements at:

https://brainly.com/question/26098908