Final answer:
To solve this problem, you can use a series of if-else statements to check if a number is divisible by 3 or 5 and print the corresponding output.
Step-by-step explanation:
To solve this problem, we will go through each integer i in the range from 1 to N and check its divisibility by 3 and 5 using the modulo operator (%) in a series of if-else statements.
If i is divisible by both 3 and 5, we will print 'FizzBuzz'. If i is only divisible by 3, we will print 'Fizz'. If i is only divisible by 5, we will print 'Buzz'. And if i is not divisible by 3 or 5, we will print the value of i.
Here's an example solution in Python:
N = 15
for i in range(1, N+1):
if i % 3 == 0 and i % 5 == 0:
print('FizzBuzz')
elif i % 3 == 0:
print('Fizz')
elif i % 5 == 0:
print('Buzz')
else:
print(i)