Solution:
The given problem is solved in Python.
print('Multiples of 5 up to 50 are: ', end = '')
for i in range(5, 50 + 1, 5):
print(i, end = ' ')
Output:
Multiples of 5 up to 50 are: 5 10 15 20 25 30 35 40 45 50
Explanation:
- Line 1: Prints a message on the screen.
- Line 2: Iterates a for loop in the range 5 to 50. We write 51 since last value is always excluded. So, 51 is excluded and the loop iterates upto 50.
- Line 3: Increment value is 5 since the multiples of 5 lies in the interval of 5.
Refer to the attachment for output.