94.9k views
5 votes
Write an if statement that assigns 100 to x when y is equal to 0.

1 Answer

3 votes

Answer:

if(y==0)

{

x=100;

}

Step-by-step explanation:

The above written if statement is for assigning 100 to x when the value of y is equal to 0.To check the value of the y I have used equal operator == which returns true when the value on it's left side is equal to the value to it's right else it returns false and for assigning the value to y I have used assignment operator =.

First it will be checked that the value y is equal to 0.If the then it return true means the if statement will execute.Inside if statement 100 is assigned to x.

User Alexander Beninski
by
7.8k points

No related questions found