cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
HELP PLEASE
HELP PLEASE
May 10, 2011 at 5:54pm UTC
Eyad
(98)
For example; if i wanna divide 89 / 25 so the answer is 3 and the remain is 11. how can i get this answer using for loop?
in other words I want it to be displayed like this (3 quarters, 1 dime and 1 penny) can someone please help me with it?
May 10, 2011 at 6:39pm UTC
Austin Covello
(11)
I don't think you'd necessarily need a for loop for that. Here's some pseudo-code:
---
variable 1 = 89 / 25
variable 2 = remainder of (89 / 25)
variable 3 = variable 2 / 10
variable 4 = remainder of (variable 2 / 10)
print "You have " variable 1 " quarters, " variable 3 " dimes, and " variable 4 " pennies."
---
The tutorials can show you all of the mathematical operators you need to code this.
May 11, 2011 at 1:29am UTC
ItsTheFruitsYeah
(22)
Also, it would be helpful in the future if you read this:
http://www.cplusplus.com/forum/beginner/1/
This will let you get better answers if you asked your questions the smart way instead of "HELP PLEASE".
And here's the link for the mathematical operators that you need to code for this:
http://www.cplusplus.com/doc/tutorial/operators/
Good luck.
May 11, 2011 at 7:45am UTC
Eyad
(98)
Thx guyz
Topic archived. No new replies allowed.