Boa tarde pessoal.
Tenho um código para achar todos os numeros primos de 1 ate N, porem ele possui função.
Estou tentando converter ela apenas para main porem estou com dificuldades na hora da impressão. Podem me ajudar?
Esse é o código com função:
#include <stdio.h>
#include <math.h>
int eh_primo(int x){
float raiz = sqrt(x);
int i;
for(i=2;i<=raiz;i++){fu
if(x%i==0){
return 0;
}
}
}
int eh_primo(int x);
int main(){
int k,n;
printf("Digite 2 numeros: (1) numero inicial (2) quantos primos:");
scanf("%d%d", &k, &n);
int cont=0;
while(cont<n){
if(eh_primo(k)){
cont++;
printf("%d:%d\n",cont, k);
}
k++;
}
}