+ 2

I need help

Read number from keyboard and print if it prime or not prime

3rd Apr 2018, 7:40 AM
pomp
1 Answer
+ 10
0)if 2 then true else 1)run a loop from 2 to that number/2 ... b 2)if n%b==0; then print "false" & break; through loop 3) else "true" . //well , different starategies are possible //I have made 1-liner recursion funcn also for that
3rd Apr 2018, 7:49 AM
Gaurav Agrawal
Gaurav Agrawal - avatar