Statement - Make an algorithm that reads a set of numbers (X) and indicates the number of even numbers (QPares) and the number of odd numbers (QImpares) read.
Note: Entry of values ends when the user enters 0.
#include <stdio.h>
main(){
int num,res,qpar=0,qimp=0;
while(num!=0){
printf("Introduza");
scanf("%d",&num);
res=num%2;
if(res==0){
qpar++;
} else {
qimp++;
}
}
printf("Pares -> %d\n",&qpar);
printf("Impares -> %d\n",&qimp);
}
I do not know what I'm doing wrong in this, it compiles well but the problem is it does not give me the right values of even and odd numbers. For the rest he is also doing the cycle correctly.