subject

I am writing a code that requires me to identify a positive integer as a prime (or not). I have looked at references on how to find it but it does not work for what I am trying to do. Below is the set of instructions. I have written the first half of the code and verified that it works. I am stuck on how to write the logic that identifies the prime based on the instructions.
Write a program that prompts the user to input a positive integer. It should then output a message indicating whether the number is a prime number.
Your program should use a loop to validate the positive integer and accept the input only when the user inputs a positive number.
Your code should be an efficient algorithm using the following note.
(Note: An even number is prime if it is 2. An odd integer is prime if it is not divisible by any odd integer less than or equal to the square root of the number.)
For the square root, import the math library (import math) and use math. sqrt() function)

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:00
The great length of north america causes the climate to be varied. true false
Answers: 2
question
Computers and Technology, 22.06.2019 19:00
In he example code, what does the title attribute create? a tool tip an element a source a markup
Answers: 1
question
Computers and Technology, 23.06.2019 12:00
If you embed a word table into powerpoint, what happens when you make edits to the embedded data? a. edits made to embedded data change the data in the source file; however, edits made to the source file will not be reflected in the embedded data. b. edits made to embedded data will change the data in the source file, and edits made to the source file will be reflected in the embedded data. c. edits made to embedded data don't change the data in the source file, nor will edits made to the source file be reflected in the embedded data. d. edits made to embedded data don't change the data in the source file; however, edits made to the source file will be reflected in the embedded data.
Answers: 1
question
Computers and Technology, 23.06.2019 16:50
15: 28read the summary of "an indian's view of indian affairs."15 betterin "an indian's view of indian affairs," it is asserted that conflicts could be reduced if white americansunderstood native americans..pswhich of the following would make this summary more complete? eleo the fact that chief joseph believes the great spirit sees everythinthe fact that chief joseph was born in oregon and is thirty-eight years oldo the fact that chief joseph states that he speaks from the hearthehehethe fact that chief joseph of the nez percé tribe made this claimebell- ==feetle===-felsefe ==submitmark this and retum.=
Answers: 3
You know the right answer?
I am writing a code that requires me to identify a positive integer as a prime (or not). I have look...
Questions
question
Mathematics, 30.03.2021 22:00
question
Mathematics, 30.03.2021 22:00
question
Mathematics, 30.03.2021 22:00
Questions on the website: 13722363