Enhance your programming skills with the RECF Programming Test. Features flashcards and multiple choice questions with hints and explanations. Prepare for success!

Multiple Choice

What is the result of integer division 7 / 3 in C?

In C, dividing two integers yields an integer result by discarding any fractional part. So 7 divided by 3 equals 2 with a remainder of 1, and the stored result is 2. If either operand were a floating-point type (for example 7.0 / 3 or 7 / 3.0), you would get a floating-point result like 2.333... instead. This is why the integer division here gives 2.

In C, dividing two integers yields an integer result by discarding any fractional part. So 7 divided by 3 equals 2 with a remainder of 1, and the stored result is 2. If either operand were a floating-point type (for example 7.0 / 3 or 7 / 3.0), you would get a floating-point result like 2.333... instead. This is why the integer division here gives 2.