cataarbelaez3132 cataarbelaez3132
  • 23-08-2019
  • Computers and Technology
contestada

What is the value stored at x, given the statements:

int x;

x = 3 / static_cast(4.5 + 6.4);

A.
.3

B.
0

C.
0275229

D.
3.3

Respuesta :

Branta Branta
  • 25-08-2019

Answer:

B. 0

Explanation:

The computation happens in the following sequence:

1) The operands 4.5 and 6.4 are added : 4.5+6.4 = 10.9

2) When this value is cast to int datatype, it becomes 10

3) 3/10 = 0.3

4) x in a variable of type int. So when a value of 0.3 is assigned to x, it is stored as 0.

If we now display the value of x using printf or cout statement, we should expect to see 0 as the value printed on the console.

Answer Link

Otras preguntas

Simplify this problem
The legs of a right triangle are 10 cm and 24 cm. What is the length of the hypotenuse? 22 cm 26 cm 30 cm 34 cm
Someone please help me with this.
To take advantage of the power of compounding, what should you do with the money an investment produces? a) spend it b) put it in a savings account c) reinvest
On a population pyramid, age is normally plotted on the Y axis. True False
A projectile is launched from a hole in the ground one foot deep. It’s height follows the equation h= -16^2+7t-1. Use factoring by perfect-squares to find the t
is 4b²+40b+20 a perfect square​
romeo and juliet iambic pentameter
This is 7 grade math can anyone help me
Why else is wrong with this sentence ??