Display the prime factors of a number using 1 loop? Write in Java or Python. Show your output.
Share
Display the prime factors of a number using 1 loop? Write in Java or Python. Show your output.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Program:
def prime_factors(number):
i = 2
while i * i <= number:
if number % i:
i += 1
else:
number //= i
print(i, end=", ")
if number > 1:
print(f"{number}.")
number = int(input("Enter a number - "))
print(f"Prime factors of {number} - ", end="")
prime_factors(number)
Answer:
\huge\pink{\underline{\boxed{\mathbb{AnSwEr}}}}
AnSwEr
____________________________
scalar quantity in physics is one that can be described by a single element of a number field such as a real number, often accompanied by units of measurement.
A scalar is usually said to be a physical quantity that only has magnitude, possibly a sign, and no other characteristics.
_____________________________