Such as 20 reply will turn on page 1, 40 reply will turn to the second page
Assuming that n is my reply to post total is 14
Assuming that M is my set how many reply will flip gathering here I set the 20
How to determine the logic to get him into
20=1
40=2
60=3
80=4
How to implement this logic, similar to the below divisible
if (n % m==0) {
System. The out. Println (" n can be divided exactly by m ");
} else {
System. The out. Println (" n can't be divided exactly by m ");
}
CodePudding user response:
Directly post/total number of pages per page down integer not equal to the page numberCodePudding user response:
Int page=n/(m + 1) + 1;CodePudding user response:
Int page=n/m + (n % m==0)? 1-0.CodePudding user response:
Int page=(n> 0? N - 1:0)/m + 1;CodePudding user response:
Int page=(int) Math. Ceil (Double. The valueOf (n)/m); Take up the wholeCodePudding user response:
Int page=(m - 1)/(n) + 1