TÓPICO
Erro de 15%, q q ta pegando? (C)
mvicente8 perguntou 2 years ago
Todos os exemplos que eu tentei tão certos. Alguém consegue ver qual o problema?
include
include
int main() { int n[5]; int i=0; int j=0; int k=0; int par=0; int positivo=0; int negativo=0;
scanf("%d %d %d %d %d",&n[0],&n[1],&n[2],&n[3],&n[4]);
while (i<=4)
{
if (n[i]%2==0)
{
par = par + 1;
}
i = i + 1;
}
int impar = 5 - par;
while (j<=4)
{
if (n[j]>0)
{
positivo = positivo + 1;
}
j = j + 1;
}
while (k<=4)
{
if (n[k]<0)
{
negativo = negativo+1;
}
k = k + 1;
}
printf("%d valores pares\n%d valores impares\n%d valores positivos\n%d valores negativos\n",par, impar, positivo, negativo);
return 0;
}
Este tópico foi resolvido e não pode receber novas respostas.