Horje
fast way to check if a number is prime C++ Code Example
fast way to check if a number is prime C++
//O(sqrt(n))
bool isPrime(int num){
    if(num <= 1) return false;
    for(int i = 2; i <= sqrt(num); i++){
          if(num % i == 0) return false;
    }
    return true;
}




Cpp

Related
how to read and parse a json file with rapidjson Code Example how to read and parse a json file with rapidjson Code Example
loop in c++ Code Example loop in c++ Code Example
passare un array a una funzione Code Example passare un array a una funzione Code Example
istream c++ Code Example istream c++ Code Example
how to make sound in c++ Code Example how to make sound in c++ Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8