Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
prime numbers min>max
//gcc 4.9.3 #include <stdio.h> int testprime(int v) { int i; for(i=2;i<v;i++) { if(v%i==0) return 0; } return 1; } int testdigit(int v,int digit) { while(v) { if(v%10==digit) return 1; v/=10; } return 0; } void swap(int *p,int *q) { int t; t=(*p); (*p)=(*q); (*q)=t; return; } main() { unsigned int min=300,max=100,digit=3,data; if(min>max) { swap(&min,&max); } printf("min=%d max=%d ",min,max); for(data=min;data<=max;data++) { if(testprime(data)&&testdigit(data,digit)) printf("%d ",data); } }
run
|
edit
|
history
|
help
0
C programming example implementing a function to set a specified bit in an int (from ECE 2534)
A_141212_OrdenarArray
main.c
150116_PrimoFactorial
MatrixMul_shortxshort
bitmask
Goodone pointer minus void pointer
Función bsearch para cadenas
structt
loop