Java Remainder of Integer Divison?

后端 未结 5 1413
甜味超标
甜味超标 2021-01-18 01:44

I was searching around about this topic but I still don\'t get it, if someone can elaborate I would be very thankful.

My task is to divide two variables as integer d

5条回答
  •  半阙折子戏
    2021-01-18 02:37

        public static void main(String[] args) {
            int dividend = 139, divisor = 7;
    
            int quotient = dividend / divisor;
            int remainder = dividend % divisor;
    
            System.out.println("The Quotient is = " + quotient);
            System.out.println("The Remainder is = " + remainder);
        }
    

    Output:

    The Quotient is = 19

    The Remainder is = 6

提交回复
热议问题