I need to count how many groups of 3 lines there are in a textfile. I wanted to simply do this by counting the lines and deviding that by three. But sometimes there is an extra empty line at the end of the file.

I need the number of groups (no_groups) to be an integer. And I nee to make sure it doesn't count a group too many.

I've using this function, which call's to itself in case there are even two extra lines (I doubt there will be):

But now I keep getting 0 groupsCode:`long no_linesdiv=0;`

long no_lines=0;

int divisible(long number,int deelbaardoor){

if (number%3 != 0){

number--;

divisible(number,deelbaardoor);

}else{

return no_linesdiv;

}

}

and in the main:

divisible(no_lines,3);

no_groups = no_linesdiv/3;