Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

I'm doing a computer program for school. I need to know a one step math formula.?

The teacher says this is 3rd grade math, but this is beyond me. One step to show how many dollars, quarters, dimes, nickels and pennies are in any number of pennies that you wish to program in. Say 1463 pennies. When you hit calculate, it should show the breakdown. I know this is 14 dollars, 2quarters, 1 dime and 3 pennies. I can't figure out how to do this in one step so the program calculates the breakdown.

1 Answer

Relevance
  • 1 decade ago

    let n = number to be evaluated

    d = dollars = trunc(n/100, 0)

    q = quarters = trunc((n - 100*d)/25, 0)

    etc.

    You can also use the modulus function to evaluate the remainder for each denomination.

    Not sure that saying "it is 3rd grade math" is entirely accurate.

Still have questions? Get your answers by asking now.