1.

Rewrite the above program using while loop​

Answer»

Question:

Rewrite the above program using while LOOP.

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

b=int(input("Enter second number"))

for i in RANGE(a,b,3):

   print(a*i)

print("Program over")

Answer:

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

b=int(input("Enter second number"))  

while a

   print(a)

   a+=3

Explanation:

  • Take upper and LOWER limits input in a and b.
  • Begin loop with condition a
  • a increases by 3 EVERY time the loop runs.



Discussion

No Comment Found