# Rounding - c++

This is a discussion on Rounding - c++ ; This is the part of the problem that I want to solve ..........The rounding rules for sales tax are that for a tax rate of n%, a shelf price of p contains (np/100 rounded up to the nearest 0.05) amount ...

1. ## Rounding

This is the part of the problem that I want to solve

..........The rounding rules for
sales tax are that for a tax rate of n%, a shelf price of p contains
(np/100 rounded up to the nearest 0.05) amount of sales
tax................

How to round up the sales tax?

2. ## Re: Rounding

* Amol:
> This is the part of the problem that I want to solve
>
>
> .........The rounding rules for
> sales tax are that for a tax rate of n%, a shelf price of p contains
> (np/100 rounded up to the nearest 0.05) amount of sales
> tax................
>
>
> How to round up the sales tax?

Since the problem statement calls for rounding up, use the ceil() function.

simpler problems, whatever comes naturally.

Then figure out how to round up to nearest 0.01. Try that. Then figure
out how to round up to nearest 0.01. Try that.

Test thoroughly.

And pray fervently that some vacuum-head doesn't try to impress us with
the purity of his head's vacuum by posting code for your homework.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?

3. ## Re: Rounding

Alf P. Steinbach <alfps@start.no> wrote in message...

> And pray fervently that some vacuum-head doesn't try to impress us with
> the purity of his head's vacuum by posting code for your homework.

Hey, I've been called worse and still survived!! <G>

Hi Alf.
--
Bob R
POVrookie

4. ## Re: Rounding

"Amol" <amolj.1306> wrote in message
> This is the part of the problem that I want to solve
>
>
> .........The rounding rules for
> sales tax are that for a tax rate of n%, a shelf price of p contains
> (np/100 rounded up to the nearest 0.05) amount of sales
> tax................
>
>
> How to round up the sales tax?

rounded up to the nearest 0.05 is kinda weird. But think how you do it
manually and do it in code.