I am searching for a way to check if a certain variable holds an integer or no. My program asks the user for the values of a set of variable then it computes the variable k needed to make another variable e an integer. The code for calculating k is essentially a for loop that increments k from zero until it reaches a value making e an integer. But I can't figure out how to check that e is an integer. Here is the code I am thinking of:
for (int k = 0; k!=wk; k++)
{
e = (1+k*f_n)/d;
if()
}
The variable wk is just there so that when e is an integer, wk is to be equal to k, and so the loop ends.