- 1

Program to check a number is prime or not

I want a program

22nd Jul 2017, 10:58 AM
srunani Mishra
srunani Mishra - avatar
14 Respostas
+ 5
22nd Jul 2017, 11:06 AM
Lord Krishna
Lord Krishna - avatar
+ 5
ok. your profile says you havent started. thus why i thought you hadnt. my bad
22nd Jul 2017, 11:06 AM
jay
jay - avatar
+ 4
maybe learn java? then you can write exactly what u need
22nd Jul 2017, 11:05 AM
jay
jay - avatar
+ 4
i can. lord krishna has provided good resources for you though
22nd Jul 2017, 11:10 AM
jay
jay - avatar
+ 4
@srunani if you want an explanation or something similar. rephrase your question accordingly so someone may give you one
22nd Jul 2017, 11:17 AM
Lord Krishna
Lord Krishna - avatar
+ 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
22nd Jul 2017, 11:36 AM
Mahdi sg
Mahdi sg - avatar
+ 1
can u help me out in this Jay?
22nd Jul 2017, 11:09 AM
srunani Mishra
srunani Mishra - avatar
+ 1
thanks Lord Krishna.
22nd Jul 2017, 11:15 AM
srunani Mishra
srunani Mishra - avatar
+ 1
thanks Lord Krishna.
22nd Jul 2017, 11:15 AM
srunani Mishra
srunani Mishra - avatar
+ 1
yah sure @lord_krishna
22nd Jul 2017, 11:19 AM
srunani Mishra
srunani Mishra - avatar
+ 1
that code works correctly , What is the problem? Explain more to solve it
22nd Jul 2017, 12:05 PM
Mahdi sg
Mahdi sg - avatar
+ 1
thank you @mahdi_sg
22nd Jul 2017, 2:08 PM
srunani Mishra
srunani Mishra - avatar
0
not this
22nd Jul 2017, 11:03 AM
srunani Mishra
srunani Mishra - avatar
0
I am learning
22nd Jul 2017, 11:06 AM
srunani Mishra
srunani Mishra - avatar