385,024 views
42 votes
42 votes
Given the code as follows: main() { int i = 3, n; float x; x = i; n = 8 % x; } What problem will occur? Group of answer choices A compilation error will occur. A run time error will occur. An inheritance error will occur. No problem will occur at all.

User IMemon
by
2.4k points

1 Answer

27 votes
27 votes

Answer:

A compilation error will occur.

Step-by-step explanation:

The % operator does not accept a float as its right-hand operand.

User Disfigure
by
3.1k points