- 1
Program to check a number is prime or not
I want a program
14 Answers
+ 5
this post and codes should help(you can use the search feature on Sololearn. there is one XD)
https://code.sololearn.com/car27y7zA18e/?ref=app
https://code.sololearn.com/cXSvy2JE1JyH/?ref=app
https://www.sololearn.com/discuss/302586/?ref=app
+ 5
ok. your profile says you havent started. thus why i thought you hadnt. my bad
+ 4
maybe learn java? then you can write exactly what u need
+ 4
i can. lord krishna has provided good resources for you though
+ 4
@srunani
if you want an explanation or something similar. rephrase your question accordingly so someone may give you one
+ 2
use this method and give it a number :
public static void checkNumber(int num){
for(int i=2;i<num;i++){
if(num%i==0){
System.out.print(num +" is not Prime!");
break;
}else if(i==num-1){
System.out.print(num+" is Prime.");
break;
}
}
}
https://code.sololearn.com/c1pTy8t0s2eG/?ref=app
+ 1
can u help me out in this Jay?
+ 1
thanks Lord Krishna.
+ 1
thanks Lord Krishna.
+ 1
yah sure @lord_krishna
+ 1
that code works correctly , What is the problem?
Explain more to solve it
+ 1
thank you @mahdi_sg
0
not this
0
I am learning