invalid operands of types 'float' and 'int' to binary 'operator%'

The error messages are pretty self-explanatory.
The operators % and & are not defined for floating point datatypes.
Try integer datatypes instead.