Ask Question

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

+3
Answers (1)
  1. 6 April, 06:22
    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?
Find an answer to your question 👍 “Write an if statement that assigns 100 to x when y is equal to 0. ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers