aydinh Posted October 28, 2009 Share Posted October 28, 2009 Right say I've got a number, x. (x is an integer) I need an equation to find out how many 5's go in to x, then how many 2's go in to the remainder, then how many 1's go in to the remainder of that, and then how many 0.5's go in to that Really simple I'm guessing and it's driving me mad, so I thought I'd just ask and get it over with? Cheers. Link to comment Share on other sites More sharing options...
0 Rob2687 Posted October 28, 2009 Share Posted October 28, 2009 Uhh...Any int divided by 1 has a remainder of zero. x is an integer so the last case with 0.5 doesn't really matter? All you have to do is take the floor of x/5. Then do x%5 to find the remainder. For the next case x is now the remainder and you do the same thing again. Take the floor of x/2. Then x%2 to find the remainder. Link to comment Share on other sites More sharing options...
0 Master1 Posted October 28, 2009 Share Posted October 28, 2009 idk but this site is good for math stuff WloframAlpha it might help you out Link to comment Share on other sites More sharing options...
0 aydinh Posted October 28, 2009 Author Share Posted October 28, 2009 Cheers guys, I used the divide then modulus method and it worked great :) Link to comment Share on other sites More sharing options...
0 Rudy Posted October 28, 2009 Share Posted October 28, 2009 Cheers guys, I used the divide then modulus method and it worked great :) That's the standard method for a change calculator assignment.....I mean program ;) Link to comment Share on other sites More sharing options...
0 aydinh Posted October 28, 2009 Author Share Posted October 28, 2009 :p It was an extra task anyway :) Link to comment Share on other sites More sharing options...
0 Rudy Posted October 28, 2009 Share Posted October 28, 2009 :p It was an extra task anyway :) Don't worry.... I was just pointing out that it's a very typical assignment question ;) Link to comment Share on other sites More sharing options...
Question
aydinh
Right say I've got a number, x. (x is an integer)
I need an equation to find out how many 5's go in to x,
then how many 2's go in to the remainder,
then how many 1's go in to the remainder of that,
and then how many 0.5's go in to that
Really simple I'm guessing and it's driving me mad, so I thought I'd just ask and get it over with?
Cheers.
Link to comment
Share on other sites
6 answers to this question
Recommended Posts