It would be better if you could use separate variables for total score, total even score and total odd score. Then in the condition check update the corresponding total variables.
int total_fh = 0, total_es = 0, total_os = 0;
if (score >=50 && score <= 100)
{
total_fh += score;
if (score % 2 == 0) {
total_es += score;
}
else if (score % 2 != 0)
{
total_os += score;
}
}
Then outside the loop, print the scores using printf
statements.
6
solved working out do while loops [closed]