How is rounding performed under integer division

How is rounding performed under integer division ?

Answer : When we do integer division it gives results in round value and it truncate it’s fractional part. Please see example below:

package com.javahonk.operatortest;

public class IntegerDivisonTest {

    public static void main(String[] args) {
	int i = 29;
	int j = 10;
	int k = i / j;
	System.out.println(k);

    }

}

 

Output:
How is rounding performed under integer division

Leave a Reply

Your email address will not be published. Required fields are marked *