C Programming :: Declarations and Initializations - Discussion
18 / 54
Integer division in a 'C' program results in
Atruncation
Brounding
Coverflow
Dnone of these
Show Explanation
Its true answer is truncation. For example if we normally divide 3/2 we get 1.5
But in c language if we do integer division 3/2 we will only get 1 as the decimal values are removed by c compiler hence it truncates the value.
Asked In ::
In C, whenever we perform an integer division, let's say we have 2 integers- 5 and 4, and we have to perform the operation 5/4. Mathematically, we are supposed to get 1.25, but in C, since we are performing an integer division so whatever answer that we will get should also result in an integer value and not a float value. So, we will get 1 as the answer and not 1.25. This is what we call as a Truncated value. Here, the C compiler chops off the decimal values so that the result is an integer.
Read Full Answer
Report Error
Please Login First Click Here
Its true answer is truncation. For example if we normally divide 3/2 we get 1.5
But in c language if we do integer division 3/2 we will only get 1 as the decimal values are removed by c compiler hence it truncates the value.
Read Full Answer
Report Error
Please Login First Click Here