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

How many angles does a house have?
The library is 0.96 miles away   from  theo'"s home Write this distance as a fraction in simplest form.
What is the cube of the quotient of 24 and 6?
Why is it incorrect to balance a chemical equation by changing the subscripts?
The ratio of boy campers to the number of girl campers is 8:7.  If there are a total of 195 children, how many are boys and how many are girls?
A ball is projected horizontally with a velocity of 30m/s from the top of a high tower. Air resistance may be neglected. After what time will it's velocity be i
equation for: Karen's ipod contains 12 fewer playlists than Clarann's ipod. the total number of playlists on both ipods is 58. Find the number of playlists on e
evarado paid $1.12 for a dozen of eggs. write and solve a proportion to determine the cost of the 3 eggs evarado needs for a recipe
What is the factors of 250,45,30 and 375,66,33 and 76,21,14 and 1260,36,18
What is the cube of the quotient of 24 and 6?