CodePudding user response:
You try a double a=1/2.0CodePudding user response:
Two type int do division, the result is an int type, 0.5 to type int variable 0, and then assigned to a, to double a=1.0/2CodePudding user response:
Or divisibleCodePudding user response:
To double a=1.0/2 or double a=1/2.0, because the two integers 1/2 division results to 0, you assigned to a double a, certainly also is 0