Ask Question
15 December, 09:31

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

+5
Answers (1)
  1. 15 December, 11:36
    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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers