Q:

Python program to find the maximum multiple from given N numbers

belongs to collection: Python basic programs

0

finding the maximum multiple of a number x from a given set of a number (set of 5 numbers in this program).

There are many ways of doing this but this time, we have to thought of most computationally efficient algorithm to do so.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Following is the code for such problem,

n = 0

num = 0

maxnum = 0

x = int(input("Enter the num of which you want to find highest multiple: "))

while n<5:
    num = int(input("Enter your number : "))
    if num%x == 0:
        if num > maxnum:
            maxnum = num
    else:
        print("Not multiple")
            
    n += 1

print("The maximum multiple :",maxnum)

Output

find maximum mulitple from given N numbers in Python

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Python basic programs

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Python program to find the least multiple from giv... >>
<< Create a stopwatch using Python...