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

where are volcanoes most likely to form
joan works for 6 hours each weekday and 8 hours total on the weekends. she earns $6 an hour on weekdays and $9 an hour on weekends. how much money does she earn
What if nitrous oxide gas doesn't work on me?
What does therapeutic cloning involve? Developing genetically identical cultures of human cells for use in drug testing Developing genetically identical culture
Find the value. A. 1 B. 2 C. 3 D. 0.5
how is a highway similar to transport systems of the body?
a dog weighs 44 pounds and the veterinaria
__________ was a major act of violence in the United States that occurred during President Bill Clinton’s term of office. The Oklahoma City bombing The garage b
how do you do 1 kilometers 125 meters - 375 meters
Change the fraction 93/1,000 to a decimal. A. 0.0093 B. 0.93 C. 0.00093 D. 0.093