Numerator or denominator or both should be float. Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#include <iostream>
int main(){
float result = 0;
result = 6 / 120;
std::cout << "Result with integers: " << result << std::endl;
result = 6.f / 120;
std::cout << "Result with float and integer: " << result << std::endl;
result = 6.f / 120.f;
std::cout << "Result with floats: " << result << std::endl;
result = 6.0 / 120.0;
std::cout << "Another result with floats: " << result << std::endl;
}