# Why is there 2 "0"s on my output in "Tuition Fee Discount"?

+1 vote
int main()
{
char Average;
int Tuition;

Grades = ( 90.00 + 87.00 + 99.00 + 75.00 + 77.00 + 80.00 + 100.00 + 94.00 + 83.00 ) / 9;

//Output
printf("Intro to Computing                :     90\n");
printf("Fundamentals of Programming       :     87\n");
printf("Understanding the Self            :     75\n");
printf("Purposive Communication           :     77\n");
printf("Mathematics in the Modern World   :     80\n");
printf("Physical Fitness and Wellness     :     100\n");
printf("Reading in the Philippine History :     94\n");
printf("NSTP1                             :     83\n");
printf("---------------------------------------------\n");
printf("General Weighted Average          :     %.2f\n", Grades);

//Scholarship Grant
printf("Scholarship Grant                 :     %c", Average);
printf("President's List");
}
printf("College Scholar");
}
printf("Dean's List");
}
else {
printf("None");
}

//Tuition Fee Discount
printf("\nTuition Fee Discount              :     %d", Tuition);
printf("100%%");
}
printf("50%%");
}
printf("30%%");
}
else {
printf("0%%");
}
return 0;
}

answered Nov 18 by (40,320 points)

To have 0% printed on the output, your code must have ended up here:

```    else {
printf("0%%");
}```

You can easily verify this by printing out the value of Grades:

`printf("Grades: %f\n", Grades);`

You can see the value of Grades is 87.222221, hence your code does what it does.

Also, I think your code doesn't really work the way you'd like it to.

```    if (Grades <= 100 && Grades >= 98) {
printf("100%%");
}
printf("50%%");
}
printf("30%%");
}
else {
printf("0%%");
}```

What happens for instance if Grades = 97.7?  Well, it ends up printing 0.

I have a feeling what you really want would be better described by this piece of code:

```    float discount = 0.0f;