How to write a program in prime or not prime | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 2

How to write a program in prime or not prime

Prime or not prime

7th May 2019, 2:20 PM
Anubhav Kumar
4 Answers
+ 4
This question has been asked multiple times. Plz use the search bar next time
7th May 2019, 3:07 PM
Rstar
Rstar - avatar
0
Loops through every number lower than it. Use the modulus % operator to check for numbers that give no remainder -- factors. If a factor exists besides 1 or the number, it's prime.
7th May 2019, 3:09 PM
James
James - avatar
- 1
Give me plzz answers all.my bro
7th May 2019, 2:20 PM
Anubhav Kumar