TOPIC

wrong answer 10% - alguém me ajuda?

Raiane Nogueira asked 6 months ago

include

int main(){

int qtd, cont = 0, x, y, resto, soma = 0, i;

scanf("%d", &qtd); while (cont != qtd){ scanf("%d %d", &x, &y);

if (x == y){ soma = 0; printf("%d\n", soma); }

resto = x%2; if (x < y){ if (resto == 0){ for(i = x+1; i < y; i = i + 2){ soma = soma + i; }

printf("%d\n", soma);

}

else{ for(i = x+2; i < y; i= i+2){ soma = soma + i; }

printf("%d\n", soma);

} soma = 0; }

resto = y%2; if (y < x){ if (resto == 0){ for(i = y+1; i < x; i = i + 2){ soma = soma + i; }

printf("%d\n", soma);
soma = 0;

}

else{ for(i = y+2; i < y; i= i+2){ soma = soma + i; }

printf("%d\n", soma);

} soma = 0; }

cont++;

} return 0; }

This topic has not been answered yet. Be the first!

Remember not post solutions. Your post may be reviewed by our moderators.