简单的分页小demo

public class Demo {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入总记录数");
        int total = sc.nextInt();
        System.out.println("请输入每页显示多少条数据");
        int size = sc.nextInt();
        int page = total % size == 0 ? total / size : total / size + 1 ;
        System.out.println("一共:"+page+"页");
    }
}

 

posted on 2017-08-16 16:29  風の嵂菄  阅读(156)  评论(0编辑  收藏  举报