diff options
author | siddhu8990 | 2017-04-19 14:57:49 +0530 |
---|---|---|
committer | siddhu8990 | 2017-04-19 14:57:49 +0530 |
commit | 1fd0dce8d72c4d5869ce5ff4025ac09af603bc0f (patch) | |
tree | 34e52b33707a829c1d8484428c96d3f1f6ce2b3a /src/c/elementaryFunctions/discrete_mathematics/primes | |
parent | 9e506f48291533cba7b4c555b0d2e98f234bfbe3 (diff) | |
download | Scilab2C_fossee_old-1fd0dce8d72c4d5869ce5ff4025ac09af603bc0f.tar.gz Scilab2C_fossee_old-1fd0dce8d72c4d5869ce5ff4025ac09af603bc0f.tar.bz2 Scilab2C_fossee_old-1fd0dce8d72c4d5869ce5ff4025ac09af603bc0f.zip |
Merged Shamik's work
Diffstat (limited to 'src/c/elementaryFunctions/discrete_mathematics/primes')
-rw-r--r-- | src/c/elementaryFunctions/discrete_mathematics/primes/dprimess.c | 24 | ||||
-rw-r--r-- | src/c/elementaryFunctions/discrete_mathematics/primes/sprimess.c | 24 |
2 files changed, 48 insertions, 0 deletions
diff --git a/src/c/elementaryFunctions/discrete_mathematics/primes/dprimess.c b/src/c/elementaryFunctions/discrete_mathematics/primes/dprimess.c new file mode 100644 index 0000000..5ecb92e --- /dev/null +++ b/src/c/elementaryFunctions/discrete_mathematics/primes/dprimess.c @@ -0,0 +1,24 @@ +#include<stdio.h> +#include "primes.h" +void dprimess(double in, double* out) +{ + int i=0,j=0,k=0,n=0,counter=0; + n=(int)in; + for(i=2;i<=n;i++) + { + counter=0; + for(j=2;j<i;j++) + { + if(i%j==0) + { + counter=1; + break; + } + } + if(counter==0) + { + out[k++]=i; + + } + } +} diff --git a/src/c/elementaryFunctions/discrete_mathematics/primes/sprimess.c b/src/c/elementaryFunctions/discrete_mathematics/primes/sprimess.c new file mode 100644 index 0000000..14aa236 --- /dev/null +++ b/src/c/elementaryFunctions/discrete_mathematics/primes/sprimess.c @@ -0,0 +1,24 @@ +#include<stdio.h> +#include "primes.h" +void sprimess(float in, float* out) +{ + int i=0,j=0,k=0,n=0,counter=0; + n=(int)in; + for(i=2;i<=n;i++) + { + counter=0; + for(j=2;j<i;j++) + { + if(i%j==0) + { + counter=1; + break; + } + } + if(counter==0) + { + out[k]=i; + k++; + } + } +} |