ok guys thank you very much, it finally worked, and yes it was missing one brace, and also the comparisons between variables where incorrect, now a simple question i suppose. why would the compiler give the following warning message:
format '%d' expects type 'int', but argument 2 has type 'int *'
if the variables are declared the same way they are here. (this is a different code) i'll post it
Code:
// Programa que calcula n numeros primos donde n es introducida por el usuario
#include <stdio.h>
#include <stdlib.h>
int main(){
int n, divisor, cont, contnum, contpr, primo;
printf("¿Cuantos numeros primos quiere calcular?\n");
printf("Ingrese la cantidad: ");
scanf("%d", &n);
printf("1");
contpr=1;
for (contnum=2;;contnum++){
primo=1;
for (divisor=2;divisor<contnum; divisor++){
if(contnum%divisor==0){
primo=0;
break;}
}
if (contpr>n){
break;}
else{
if (primo==1){
printf(", %d", &contnum);
contpr++;}
}
}
}
it says that the error is on line 24.
thanks!