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

What integer is located 2 units to the right of -6 on a number line? 0 -8 -4 -2
Which of the following fractions is equivalent to 3/8? A.6/14 B.9/24 C.4/9 D.15/35
Estimate the sum by rounding each mixed number to the nearest half or whole number. 8 1/5+ 1 7/16
eddie has seven pennies,four nickels,eight dimes,and seven quarters.
A team t-shirt costs $3 per adult and $2 per child. On a certain day, the total number of adults (a) and children (c) who bought shirts was 100, and the total m
what are the 3 enomic stancesthat a government may have
How did Marcus Aurelius and Antoninus Pius differ? Pius hurt the economy, while Aurelius helped it by lowering taxes. Pius wanted to conquer the world, while Au
Which of the following points does not lie on the graph of y = log3x? (0, 1) (27, 3) (1, 0)
which number is 100 less then 38 tens
how are american literature and the american identity interrelated