FLOWCALC = countA/((pTime-cTime)/1000)*60;Notice that this is ALL integer arithmetic. Unless the loop takes more than a second to execute (highly unlikely), (pTime - cTime)/1000 will always be 0. (pTime - cTime)/1000.0 would not.