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

If a machine takes 1 minute to fill 6 cartons of eggs, about how long will it take to fill 418 cartons?
how would you classify the relationship between the age of people on the number of books they read
name the biome that has nutrient rich soil and is most often used for agriculture
is the original climax community in an ecosystem more likely to be restored after a natural disturbance or a human-caused disturbance?
Please help with the 4th one
For each handmade greeting card jacqui sells,she makes a profit of $0.35. In one week,she made a profit of $42. She sell the cards for $0.75 each. A. About ho
Do you know what 48% of 50 is?
Which of the following elements is not necessary to prevent value conflicts in the work place? A. Honest communication B. Consideration C. Tolerance D. Avoidan
The amendments designed to secure the liberties of citizens and to prevent government from taking away these liberties are known as the Articles. the Declaratio
Please help with the 4th one