MsBeautiful6250 MsBeautiful6250
  • 03-01-2021
  • Computers and Technology
contestada

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

int x;
x=3/(int)(4.5+6.4)

a. 0.3
b. 0
c. .275229
d. 3.3
e. None of these

Respuesta :

MrRoyal
MrRoyal MrRoyal
  • 05-01-2021

Answer:

0.

Explanation:

Given

int x;

x=3/(int)(4.5+6.4)

Required

What is x?

The first line of the code segment declares x as integer. This means that, it will only hold non decimal numbers.

With the above explanation, options (a), (c) and (d) can not be true.

Solving further:

x=3/(int)(4.5+6.4)

The computer evaluates the denominator as:

x=3/(int)(10.9)

The denominator is then converted to an integer. So, we have:

x = 3/10;

3/10 = 0.3 but

Recall that: x will only hold non decimal numbers.

So:

x = 0;

Answer Link

Otras preguntas

explain in steps how to graph this linear inequality 2x+3y > -2
How many moles of water (H2O) would be produced if 10 moles of O2 gas reacted completely with excess H2 gas?2 H2(g) + O2(g) → 2 H2O(g)A. 5 B. 10 C. 20 D. 30
what is glossities and deficiency
How to find the reference angle of -11pi/3 ?
What is the highest mountain on each continent?
What's the other word stubborn; inflexible
How do we use the Pythagoras theorem in "everyday life".
Molecular scientists can read the DNA code and compare the DNA of different organisms. This concept is used in molecular clocks to determine which of the follow
a subway train starts from rest at a station and accelerates uniformly at 1.8m/s^2 for 15 sec. then it runs at a constant speed for the next 35 sec. before dece
explain why the motion of a body which is moving with constant speed in a circular path is said to be accelerated ?