Division happens before assignment

Without running the program, give its exact two output lines. For p and q, state the type of the division operation before explaining the stored double value. Explain the sign and magnitude of r and s using C17 integer division, and check the relationship between quotient, divisor and remainder.

    Finally explain why changing double p = a / b; to double p = (double)(a / b); does not recover the discarded fraction. All shown divisions have nonzero divisors and small representable results.

#include <stdio.h>
int main(void)
{
    int a = 7;
    int b = 2;
    double p = a / b;
    double q = (double)a / b;
    int r = -7 / 2;
    int s = -7 % 2;
    printf("p=%.1f q=%.1f r=%d s=%d\n", p, q, r, s);
    printf("rebuild=%d\n", r * 2 + s);
    return 0;
}

