Floor division with negative number

The // operator explicitly floors the result. Quoting the Binary arithmetic operations documentation: the result is that of mathematical division with the ‘floor’ function applied to the result. Flooring is not the same thing as rounding to 0; flooring always moves to the lower integer value. See the math.floor() function: Return the floor of x, … Read more

C: converting Farenheit to Celsius

The scanf call uses the wrong format string. You are reading an int so you need it to be: scanf(“%d”, &fahrenheit); The expression 5/9 is evaluated using integer division. In fact the compiler can work it out at compile time. That expression evaluates to 0. You need to perform floating point division. For instance: 5.0/9 … Read more

tech