#include <iostream>
using namespace std;
int i=0;
//funcion primos
bool primos(int);
int main() {
int num,s=0,p=0;
float prom=0;
while (1) {
cout << "Ingrese un numero positivo, [para terminar ingrese un numero negativo]: ";
cin >> num;
if (num < 0)
break;
else
if (primos(num))
p += 1;
i += 1;
s = s + num;
}
prom = (float)s/i;
cout << "\nEl promedio de los numeros es " << prom << endl;
cout << "Numeros primos ingresados " << p << endl;
return 0;
}
//funcion
bool primos (int n) {
int j,c;
for (j=2; j<=n; j++) {
if (n % j == 0)
c += 1;
}
if (c == 1)
return true;
else
return false;
}