# Simple math problem

This topic is 4949 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hey everyone... I have a simple problem. best way to ask this is with an example :) int i = 25 / 10; I need this to equal 3. But I only ever get 2. I am writing code that breaks up data into smaller portions and in the about example I would need to know that I need 3 portions to store 25 whereas 2 portions would only store 20... know what I mean? Thanks for the help Michael

##### Share on other sites
The easiest way is to add the divisor - 1. so (25 + (10-1) ) / 10 = 3.

Then anything from 21-30 is 3, 31-40 is 4, etc.

##### Share on other sites
Ironpoint: Thanks for the quick reply.... that works and is exactly what I'm looking for :)

Mike

1. 1
Rutin
27
2. 2
3. 3
4. 4
5. 5

• 11
• 11
• 10
• 13
• 20
• ### Forum Statistics

• Total Topics
632948
• Total Posts
3009399
• ### Who's Online (See full list)

There are no registered users currently online

×