Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - C language questions, two judgments about whether the division of two numbers is an integer.
C language questions, two judgments about whether the division of two numbers is an integer.
M = n/i means m = (double)(n/i).

After dividing by int data, the answer is still int.

Take n = 4 and I = 3 as an example.

m =(double)(n/I)=(double)(4/3)=(double) 1 = 1,

To judge whether m divided by n is divisible, you can use m%n == 0 or n%m == 0, where m%n represents the remainder of m divided by n, and the remainder is divisible if it is 0.