Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

check prime cpp gfg

bool isPrime(int s){
   if(s <= 1) return false;
   if(s == 2) return true;
   for(int i = 2; i * i <= s; i++) {
       if(s % i== 0) return false;
   }
   return true;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #check #prime #cpp #gfg
ADD COMMENT
Topic
Name
3+4 =