jademartin3564 jademartin3564
  • 14-09-2019
  • Computers and Technology
contestada

Write an if/else statement that assigns 0 to x when y is equal to 10; otherwise it should assign

1 to x.

Respuesta :

ExieFansler ExieFansler
  • 17-09-2019

Answer:

if(y==10)

{

     x=0;   // assigning 0 to x if y equals 10.

}

else

{

   x=1;   // assigning 1 to x otherwise.

}

Explanation:

In the if statement i have used equal operator == which returns true if value to it's right is equal to value to it's left otherwise false.By using this operator checking value of y and if it is 10 assigning 0 to x and if it is false assigning 1 to x.

Answer Link

Otras preguntas

A manager has determined that a potential new product can be sold at a price of $25 each. The cost to produce the product is $17.5, but the equipment necessary
which three statements best describe modern china
What is the value of log27 165
the area of a circle whose radius is 2.1m³is 13.85m²TRUE OF FALSE​
3) John Wayne died of cancer. In 1955, he was in Utah shooting the film The Conqueror. Across the state line, in Nevada, the U.S. military was testing the atomi
Let R(x)=3x3+2x2+x and S(x)=4x2+1. Find R(x)−S(x).
How would you compare and contrast the views of Eric Foner's "Who Is an American" with Ronald Takaki’s view of what an American is in Chapter One of "A Differen
Write a free verse poem about 5 to 7 senteces
Three unit squares (1-by-1 squares) and two line segments connecting two pairs of vertices are shown. What is the area of AABC?
find an esxpression for the nth term of 1,4,7 hurrrrryyyy