+ 2
How to check that the nuber contains a prime number in a integer input? Java
using scanner class
3 Réponses
+ 10
//if u want code☺
https://code.sololearn.com/cv93VXE8uO8g/?ref=app
+ 4
If n is divisible by any number from 2 to sqrt(n), where n is the number inputted by the user and n != 2 (2 is prime). Then n is a prime.
+ 3
Prime number, is number that could be divided only by 1 and by it self. So, i would use a for, and divide number by increasing I starting from 1, if I divides with out lefting(Eg 5%5=0) count it. And if count equal to 2, it is a prime number.