0

How to fine prime number in C++ using easy code?

I wanna learn to find prime number using c++

12th Apr 2018, 7:16 PM
Mushtaq Khan
Mushtaq Khan - avatar
3 Respuestas
12th Apr 2018, 7:19 PM
🇮🇷 M N
+ 1
//Lengthy? As in code length or time?? In coding, you need to sacrifice readability for shorter length. So if you want shorter it will be less readable. //Ps. You can use recursion for "shorter length" bool isprime(int n,int i){ if(n%i==0){ if(i==1) return true; else return false; } else return isprime(n,i-1); } Where i=sqrt(n)
13th Apr 2018, 7:03 AM
Twenty-three
0
its lengthy code
12th Apr 2018, 7:22 PM
Mushtaq Khan
Mushtaq Khan - avatar