Computer Science, asked by kaberighosh222, 12 days ago

Print a series of numbers divisible by 3 from 1 to n in python answer​

Answers

Answered by Anonymous
1

Answer:

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

print("Numbers divisible by 3 from 1 to ", n, " are: ")

for i in range(3, n, 3):

print(i)

Answered by anindyaadhikari13
3

\textsf{\large{\underline{Solution}:}}

The given problem is solved using language - Python.

n=int(input('Enter limit: '))

print('\nHere is your series:')

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

   print(i,end=' ')

\textsf{\large{\underline{Explanation}:}}

  1. Line 1: Accepts the limit from the user.
  2. Line 2: Display a message.
  3. Line 3: A loop is created to display the numbers.
  4. Line 4: Numbers are displayed using print() statement.

See attachment for output.

Attachments:
Similar questions