53.7k views
1 vote
Write a program that displays the number array below as an output. Use only do while

loop. N is a number entered by an user.

13 19 25 31 37 43 49 … N

1 Answer

1 vote

Here's the Python code to solve the problem using a do-while loop:

n = int(input("Enter a number: "))

num = 13

print(num, end=" ")

while True:

num += 6

if num > n:

break

print(num, end=" ")

User Shadowtrot
by
8.0k points

No related questions found