CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Format:
Recent snippets matching tags of prime
C++
bool isPrimef(int n){
    if (n == 1     ) return false;
    if (n <  4     ) return true;
    if (n %  2 == 0) return false;
    if (n <  9     ) return true;
    if (n %  3 == 0) return false;
    else{
        int r = std::sqrt(n);
        int f = 5;
        while (f <= r){
by Pella86   December 23, 2011 @ 5:31pm
66 Views
no comments
 
C++
from math import *
 
def sumOfDigit(n):
    if n<10: return n
    sum = 0
    if n >0:
        sum += n%10
        n /= 10
    return sum
by Pella86   December 23, 2011 @ 5:10pm
118 Views
no comments
 
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate