Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
150109_RecursividadPrimo
//Title of this code //gcc 4.8.2 #include <stdio.h> #include <math.h> short esPrimo(long p); long siguientePrimo(long p); short esCompuesto(long p); int main(void) { long p = 29; if(esPrimo(p)) { printf("%ld NO es PRIMO\n\n", p); } else { printf("%ld SI es PRIMO\n\n", p); } return 0; } short esPrimo(long p) { if(p == 0|| p == 1) return 1; long d; for(d = 2 ; d <= sqrt(p); d = siguientePrimo(d)); return p % d; } long siguientePrimo(long p) { do { p++; }while(esPrimo(p)); return p; }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Lab 9 v0.96
C Array Demonstration
tarea1
Anutter juan
Command Expressions in Gnu C
linear_search.c
Stub Program for Problem 5 HW 2
C_141106_Factorial
1233333
Rotación matriz anti horaria
Please log in to post a comment.