Hey first post. I have to write a program that takes a food bill and does 15% gratuity and rounds UP! I am using floating point numbers and cant figure out how to round up or, round at all >.>. I will post my code if that will help anybody help me :). Thanks in advance guys
If you have your bill and you want to round it up, you can use the fact that if you cast the variable to an integer, the digits behind the point will simply be cut off. To round up, you simply have to add 1.
So, basically, it comes to that
1 2 3 4 5
int rounded_bill;
float bill;
bill = 15.32;
rounded_bil = bill+1;