asked 13.9k views
2 votes
What is the result of the following expression: (int) 4.2/5 ?

a) 0.84
b) 0.8
c) 0.9
d) 0.85

asked
User Mkoch
by
8.4k points

1 Answer

5 votes

Final answer:

The expression (int) 4.2/5 results in 0.8 after truncating the decimal part to an integer which gives 4, and then dividing by 5.

Step-by-step explanation:

The result of the expression (int) 4.2/5 is determined by first considering the cast to an integer type which truncates the decimal part of the number 4.2 (making it simply 4) before the division is performed. Therefore, the calculation becomes 4 / 5, which is a mathematical evaluation yielding a result of 0.8. So, the correct answer is option b) 0.8.

answered
User Mio
by
8.6k points

No related questions found

Welcome to Qamnty — a place to ask, share, and grow together. Join our community and get real answers from real people.