110k views
4 votes
Rewrite the program below without using any "for loop"

start = input ( ' Enter the start : ' )
start = int (start)

end = input ( 'Enter the end: ' )
end = int (end)

increase = input ( 'Enter how much i is to be incremented in each iteration: ' )
increase = int (increase)

for i in range (start, end, increase) :
if i %2 == 0 :
print (i, 'is an even number.')
else :
print (i, ' is an odd number.')

1 Answer

6 votes

Answer:

start = input('Enter the start: ')

start = int(start)

end = input('Enter the end: ')

end = int(end)

increase = input('Enter how much i is to be incremented in each iteration: ')

increase = int(increase)

i = start

while i < end:

if i % 2 == 0:

print(i, 'is an even number.')

else:

print(i, 'is an odd number.')

i += increase

Step-by-step explanation:

User VforVitamin
by
8.7k points

No related questions found