/* File: primes.c The implementation of two functions for prime numbers. */ #include "primes.h" #include int isprime(int n) { int i, sq ; sq = sqrt(n) ; for (i = 2 ; i <= sq ; i++) { if ( n % i == 0 ) return 0 ; } return 1 ; } int findprime(int n) { int m ; m = n + 1 ; while ( !isprime(m) ) m++ ; return m ; }