If the declared variable is of type int, the %d format should be used for scanf input and printf output.
If the declared variable is of floating-point type, the %f format should be used for scanf input and printf output.
Otherwise, the wrong format is used and the output is garbled.
If you have any questions, please leave a message.