#include<stdio.h>intmain(){intk,repeticao;intvalor,numero;intparidade=0;scanf("%d", &repeticao);
for( k = 0; k < repeticao; k++ ){
int numero,sequencia;
scanf("%lld", &numero);
valor = numero/2;
while( valor != 0 ){
sequencia = numero%2;
if( sequencia == 1)
{
paridade++;
}
numero = valor;
valor = numero/2;
if (valor == 0)
{
paridade++;
}
}
printf("%d\n", paridade);
paridade = 0;
}
return 0;
}
My code is working for the two inputs given in the example: 3 and 21, but in the third entry it returns 15, instead of 50. (123456789123456789) my output is 1 (wrong too) when I put only one repetition (123456789), my output is correct (16), the third input is the repetition of 1 to 9 (3 times), and when I repeat it twice (123456789123456789) . Can you help me please?