Computing.Net > Forums > Programming > Help with problem in C

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

Help with problem in C

Reply to Message Icon

Name: Nick
Date: January 10, 2003 at 10:45:02 Pacific
OS: win98
CPU/Ram: p2/128
Comment:

I need help with one of my homework review problems.

If a child bought 147 cans of beans for his family, and could only carry 45 cans at a time, how many trips home must he take?

Please help. I'ts due tommorrow.



Sponsored Link
Ads by Google

Response Number 1
Name: Don Arnett
Date: January 10, 2003 at 11:12:51 Pacific
Reply:

How many beans are in each can??


0

Response Number 2
Name: kev
Date: January 10, 2003 at 13:00:41 Pacific
Reply:

Uhh... This doesn't seem to be that hard of a problem...

147/45 = 3.2666 which rounds to 4 trips.

Make a 'cans' variable and a 'carrying' variable and divide 'cans' by 'carrying'. Then ceil the answer since you can't make .2666 of a trip - you either make the trip or you don't.

The number of beans in each can is irrelevant.

Kevin.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


flash (*.swf) links Problem with opening VB d...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Help with problem in C

help with classes in c++ www.computing.net/answers/programming/help-with-classes-in-c/11749.html

Help with a C Program / Newbie www.computing.net/answers/programming/help-with-a-c-program-newbie/8071.html

Need help with CRC in C Lanquage. www.computing.net/answers/programming/need-help-with-crc-in-c-lanquage/9678.html