Computer Science, asked by Xiphodon, 8 months ago

Rewrite the following code of program using the for loop in python:

a=int(input("Enter a number"))
i=a
while i>=0:
print(a*i)
i=i-2​

Answers

Answered by karanjotgaidu
37

ANSWER:-

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

for i in range(a, - 1, - 2):

print(a*i)

Hope it helps...

Answered by seemarathi10
0

Answer:

Coverting 'while' loop to 'for' loop. Write the following for conversion of 'while' loop to 'for' loop:-

Explanation:

a=int(input("Enter a Number:"))

for i in range(a, -1, -2):

print(a*i)

Similar questions