Answer to Question #245119 in Python for Raju

Question #245119

First Prime Number

You are given N inputs. Write a program to print the first prime number in the given inputs.


1
Expert's answer
2021-10-03T11:45:36-0400
n = int(input("Enter number of integers: "))
numbers = []


for i in range(n):
    number = int(input("Enter number: "))
    isPrime=True
    if number > 1:
        for j in range(2, number):
            if (number % j) == 0:
                isPrime=False
                break
        if isPrime==True:
            numbers.append(number)
                
print("The first prime number in the given inputs is: "+str(numbers[0]))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

sandy
20.09.22, 07:43

Working!!!! thank u

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS