Plastic times 1.0
Sum = n/p; Since n and p are both integers, the result is also an integer. If you want to get floating-point numbers without modifying the declaration, you can write the following code:

sum =(n/ 1.0)/p;

Let's do it ~~n/ 1.0. What you get is the operation between floating point number, floating point number and integer, and the compiler will automatically convert it into floating point number for calculation, and you will get the result you want ~