+ 3
Verstappen Because operation happens from right to left. So first it will be divide then assign to double variable. You can also do this double a=(double)22/7;
5th Jul 2021, 4:24 PM
A͢J
A͢J - avatar
+ 2
Because you are dividing two integers (22 and 7) So, the result will be an integer. try 22.0/7 or 22/7.0 or 22.0/7.0
5th Jul 2021, 4:18 PM
zak00aria
zak00aria - avatar
+ 2
in the C language if you divide numbers the type of the result will be the type with max memory, so: int/int = int double/int =double .... so in your case, double a=22/7; you just convert an int into a double.
5th Jul 2021, 4:34 PM
zak00aria
zak00aria - avatar
+ 1
it will be double, why...? I don't know hhhh
5th Jul 2021, 4:46 PM
zak00aria
zak00aria - avatar
+ 1
zak aria, Verstappen implicit conversion isn't only about size in memory, you can see the documentation here: https://en.cppreference.com/w/c/language/conversion
7th Jul 2021, 1:43 AM
Angelo
Angelo - avatar