Python program to find multiples of an integer defined by user and in the range which is also defined by the user. Implementing using both while loop and for loop.

Here is the code for a python program to find multiples of 5 in the range defined by the user. Implementing using both while loop and for loop.


#Python program to find multiples of and integer defined by the user in the range which is also defined by the user. Implementing using both while loop and for loop.



#Using while loop
integerInput = int(input('Enter the integer to find its multiples: '))
startingRange = int(input('Enter the starting point: '))
endPoint = int(input('Enter the end point: '))
while startingRange <= endPoint:
    print(integerInput * startingRange)
    startingRange += 1



#Using for loop
integerInput = int(input('Enter the integer to find its multiples: '))
startingRange = int(input('Enter the starting point: '))
endPoint = int(input('Enter the end point: '))
for i in range(startingRange, endPoint + 1):
    print(integerInput * i)

# This code is contributed by Ahmad Shafiq
callout-flag

Love this read? Subscribe to Modernage!

Do you have any queries? You can ask in the comments. We, at Modernage answer each and every question, asked in the comments, so If you have any queries, or you want to know about any specific platform you can ask in the comments below

Author

Leave a Reply

girl-carrying-document

More Articles.

SUBSCRIBE TO MODERNAGE

Top Posts

Author

SUBSCRIBE TO MODERNAGE

Technology

SUBSCRIBE TO MODERNAGE

Python

girl-carrying-document

More Articles.