samzee06 samzee06
  • 15-10-2020
  • Computers and Technology
contestada

What does the following if statement do?

if (num1 == Math.abs(num1))

Respuesta :

Cytokine
Cytokine Cytokine
  • 15-10-2020

This statement checks if num1 is equal to the absolute value of num1

For instance,

num1 = 4 and the absolute value of num1 = 4. This would run the code inside the if statement but if num1 = -1 the absolute value of num1 = 1 and the if stamtent would be skipped because -1 does not equal 1

Answer Link

Otras preguntas

What is William Howell's argument in "Back of history (Man in the Beginning)?"
During math club, Richard is given four sets of numbers. Set 1: -3 and -7.32 Set 2: -4 and 2 4/5 Set 3: -5 and -10 Set 4: 8 and 13.35 Which set(s) of numbers ca
One weakness of the Articles of Confederation was that it A. gave the federal government too much power B. required unanimous state consent to amend it C. place
Combining like terms Simplify each expression 1.) (0b + 10) + 5(b+2) 2.) - 7(n + 3) - 8(1 + 8n) Rewrite each expression using the distributive property. Then
Lee la descripción y escribe la respuesta. Read the description and write the response. Él es un expresionista mexicano. Inició el movimiento muralista con sus
What is 5.496 to the nearest tenths
Which method has been used the most often to add amendments to the constitution? select one: a. proposal by congress; ratification by state legislatures b. prop
sorry for the quality. please help x
What is the common difference in the sequence 8, 16, 24, 32.....?
the name of this famous opera is lohengrin what is the noun in this sentence