How to define mathematically the integer part of an average? Scenario: Suppose I have three numbers: 1, 3 and 4. The average of the three numbers are 2.67 (to 2 decimal places). It many real-world applications, there is the need to consider only the "whole number", that is, the integer part, hence the value 2 only.
Question: How do I define using mathematical expression this particular issue, that is, consider only the whole number result of the average expression?
Thank you.
You can define the integral part using Greatest integer function(represented as |_ _|).

So, greatest integer(2.67) =  |_ 2.67 _| = 2.

And, in almost all of the programming languages there exists methods/functions defined in mathematical libraries to achieve the same.

In Java, you can achieve the same using double floor(double d) method.

Ex :- Math.floor(2.67) = 2.0 and then you can convert it into int using down-casting OR down promotion.

int res = (int)(Math.floor(2.67));


As mentioned by Evert, if you're performing operations with negative average, then  you need to use smallest-integer function(ceil function).

int res = (int)(Math.ceil(2.67));


So, your code would be :-

if(avg&gt;=0)
Math.floor(avg);
else
Math.ceil(avg);
Mathematically, 
     Avg(n1,n2,...nm) = p/q for lowest values (no more divisible) for all p belongs to natural number and q =1.