If I have given a certain lines per page and have to find how many pages have been used. if I divide it, still I don’t get 2 pages :
Dim lines As Integer = 68
Dim lines_per_page As Integer = 65
Dim pages_used As Integer
Pages_used = lines_per_page / lines
Can you help please.
You’re doing your division backwards. You must divide total lines by lines-per-page. See how the terms cancel in this way:
x pages = (y lines/1 page) / (z lines) << yeilds 1/pages (wrong!)
x pages = (z lines) / (y lines/1 page) = (z lines) * (1 page / y lines) << correct!
Also note that you need to perform double division, not integer division, then round the resulting value up since a partial page must be rounded to a full page.