imtrying77 imtrying77
  • 07-07-2020
  • Computers and Technology
contestada

What is the value of the var variable after the execution of the following snippet of code:
int var;
var = -1;
var = var - 1;
var = var - var;

Respuesta :

MrRoyal
MrRoyal MrRoyal
  • 12-07-2020

Answer:

The value of var is 0

Explanation:

Given:

The code snippet above

Required

Find the value of var after program execution

This line declares var as type integer

int var;

This line initializes var to -1

var = -1;

This line subtracts 1 from var; var - 1 = -1 -1 = -2

var = var - 1;

At this stage the value of var is -2

This line subtracts the value of var from var; i.e. -2 - (-2) = -2 + 2 = 0

var = var - var;

At this stage, the value of var is 0

Answer Link

Otras preguntas

NEED HELP ASAP WILL MARK BRAINLIEST Isotopes are _____________. Compounds Atoms of the same element but with different mass Atoms that have a charge Atoms
what does 4 + 5 equal
A student pot acabe of better on a metal rod. Then be placed the other end of the red in a beaker of hot water. The setup for the investigation is shown below T
PLEASE HELP ME IM BEING TIMEDD
Solve the inequality.−2(x − 3) − 4 ≥ 3x − 5(x − 1)
Write an expression for "n decreased by 3
Please help!!!!!!!!!​
Christian's furniture store buys a desk and chair at a wholesale price of $320.00 If the markup rate at Christian's store is 40%, what is the total markup in d
Is there still separation made between those who inherit with wealth, the old rich and the new rich ? Explain
what will happen if a low massive main sequence star runs out of hydrogen fuel?​