Hey!
I'm on university now, and I'm gonna learn C.
So I downloaded Dev-C++ and accessed my school's tutorial.
Here is the code:
code:
#include <stdio.h>
int main()
{
int n, par, impar, num;
printf("Digite o tamanho da sequencia: "); /* mostra mensagem na tela */
scanf("%d", &n); /* le informacao do teclado */
par = 0;
impar = 0;
cont = 0;
while (cont < n)
{
printf("Digite o %do. numero: ", cont+1);
scanf("%d", &num);
if (num%2 == 0) par = par + 1;
else impar = impar + 1;
cont = cont + 1;
}
printf("A sequencia e' formada por %d numeros pares e %d impares.\n\n",
par,impar)
return 0;
}
Actually it's not about the code, cuz it's correct. But when I click "compile", the program can't do this and show me "[Build Error] [main.o] Error 1".
Do you have any idea about it?
Edit: I was looking for other tutorials, and it seems to happen to everyone I try.