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

The entire region of Northern Africa and southwest Asia has a climate generally described as?
The Indus, Ganges, and Brahmaputra were important to ancient India because they were
The circumference of a circle is 6.28.What is the area of the circle?
Please tell me five slogans on conservation of natural vegetation.
Buck drove 220 miles in 5 hours. What was his average rate of speed?
The dimensions of a brick that weighs 25 N are 0.19 m × 0.07 m × 0.095 m. What pressure does the brick exert on the ground if it is resting on its largest face?
Which word is an interjection commonly used in advertising?
The process by which rocks are broken down into smaller fragments by the atmosphere and other factors in the environment is called?
(X+12) 2 ÷ x2-144 ×-12. 12×-144
The base of right prism is rhombus of diagonal is 6 and 8cm and altitude is 12 cm find total surface area