get float value in division in c++ code example Example: cpp get float from integer division float ans = (float)a / (float)b;