Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
150116_FactorialPrimo
//Title of this code //gcc 4.8.2 #include <stdio.h> #include <math.h> short esPrimoFactorial(long n); long factorial(long n); short esPrimo(long n); int main(void) { long n; for(n = 0 ; n < 20 ; n++) { if(esPrimoFactorial(n)) { printf("%3ld --> %20ld SÍ es PRIMO\n", n, factorial(n) - 1); } else { printf("%3ld --> %20ld NO es PRIMO\n", n, factorial(n) -1); } } return 0; } short esPrimoFactorial(long n) { return esPrimo(factorial(n) - 1); } long factorial(long n) { long F = 1; while(n) F *= n--; return F; } short esPrimo(long n) { if(n <= 2) return 1; long d; for(d = 2 ; d <= sqrt(n) && n % d ; d++); return n % d; }
run
|
edit
|
history
|
help
0
18BCE2182 ASSESS_1 Q1-7
Day 2 String Manipulation
150112_FuncionesOrdenArray
sample.c
funcion dar vuelta numero
Nitheesh
bitwise operations
Sheldon 9 area none aliens as aliens and farms Lockheed Kelly and lame lead district 9
fgets and basic string manipulation
19BCE0666.C