Ask Question
13 April, 09:39

Write an if statement that assigns 100 to x when y is equal to 0.

+4
Answers (1)
  1. 13 April, 13:12
    0
    if (y==0)

    {

    x=100;

    }

    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.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write an if statement that assigns 100 to x when y is equal to 0. ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers