Write a program with while loop that prints all numbers between 5 and 100 (inclusive) that are divisible by 5.
Code:
x=5
#Here we initialized the x as 5
print("Numbers that are divisible by 5 are: ")
while(x<=100):
#The while loop iterate from 5 to 100
if(x%5==0):
#If the x is divisble by 5 then we print the x value
print(x)
x+=1
#here we increment the value of x
Output:
Indentation:
Get Answers For Free
Most questions answered within 1 hours.