Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

c++ prime

bool prime(int a) { 
    if (a < 2)
        return false;
    for (int i = 2; i * i <= a; i++) {
        if (a % i == 0)
            return false;
    }
    return true;
}
 
PREVIOUS NEXT
Tagged: #prime
ADD COMMENT
Topic
Name
6+7 =