I have an expression of n like (30 - n(n - 1)) / 2n. And I want search the possible n which will be my answer only when the result is an integer. Is there any way to decide whether the result of this expression is an integer or not.
The only way that I can come up with is(in pseudo code ) :
for float n <- 1 to 100
do float result = expression(n);
int part = (int) result;
if ( result - part < EPS )
then good to go
int, the expression will be an ineger. Am I wrong?