New Question!!
WAP to print the following series
Answers
Answered by
6
number = 15
n_term = int(input("Enter nTH Term: "))
loop_controller = 0
while loop_controller <= n_term:
print(number, end=" ")
number = (number*10)+6
loop_controller = loop_controller + 1
if loop_controller == n_term:
break
print(number, end=" ")
number = (number*10)+3
loop_controller = loop_controller + 1
if loop_controller == n_term:
break
Answered by
4
Answer:
The given code is written in Python.
a,b,n=15,6,int(input("Enter limit - "))
for i in range(n):
print(a,end=" ")
a=a*10+b
b=3 if b==6 else 6
Algorithm:
- Start program.
- Accepting the limit.
- Initializing a = 15, b = 6
- Loop i = 0 to n-1:
- Display the value of a
- Multiply a by 10 and add b to it.
- Change b to 3 if b is 6 or else 6.
- End loop.
- End program.
See the attachment for output.
•••♪
Attachments:
Similar questions
Science,
1 month ago
Math,
1 month ago
English,
2 months ago
Social Sciences,
9 months ago
English,
9 months ago