Question

Ex-28. Loops. Construct pseudocode and flowchart to determine if integer N is prime . [Python]

Ex-28. Loops. Construct pseudocode and flowchart to determine if integer N is prime

. [Python]

0 0
Add a comment Improve this question Transcribed image text
Answer #1

`Hey,

Note: If you have any queries related the answer please do comment. I would be very happy to resolve all your queries.

Note: Brother sometimes while uploading on HomeworkLib the indentations change. So, I request you to verify it with screenshot once. This is the link where I have saved the code too

https://onlinegdb.com/By9uixbVI

# Python program to check if the input number is prime or not
#Take input from the user
num = int(input("Please enter the number: "))
#Check if the given number is greater than 1
if num > 1:
  
# Iterate from 2 to n / 2
for i in range(2, num//2):

# If num is divisible by any number between
# 2 and n / 2, it is not prime
if (num % i) == 0:
print(num, "is not a prime number")
break
else:
print(num, "is a prime number")
  
else:
print(num, "is not a prime number")

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
Ex-28. Loops. Construct pseudocode and flowchart to determine if integer N is prime . [Python]
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT