Ask Question
6 December, 20:43

Translate each of the following English statements into logical tests that could be used in an if/else statement. Write the appropriate logical test for each statement below. Assume that three int variables, x, y, and z, have already been declared. a. z is odd. b. z is not greater than y's square root. c. y is positive. d. Either x or y is even, and the other is odd. e. y is a multiple of z. f. z is not zero. g. y is greater in magnitude than z. h. x and z are of opposite signs. i. y is a nonnegative one-digit number. j. z is nonnegative. k. x is evenl. x is closer in value to y than z is.

+2
Answers (1)
  1. 6 December, 21:31
    0
    Answer and Explanation:

    The following answers are:

    Answer a).

    z%2==1

    z is an odd

    if z is divided by 2 and the remainder is 1 then z is odd.

    Answer b).

    z < = Math. sqrt (y)

    checking that the y is greater than z's square root.

    Answer c).

    y>0

    Check that y is the positive.

    Answer d).

    x % 2! = y % 2

    check that x is an even or y is an odd.

    Without using & operator.

    Answer e).

    y % z = = 0

    Check that y is the multiple of z.

    Answer f).

    z!=0

    check that z is not 0.

    Answer g).

    Math. abs (y) >Math. abs (z)

    z is not greater magnitude than y.

    Answer h).

    (x > = 0) = = (z < 0)

    Answer i).

    y % 10 = = y

    y is the non-negative one digit number.

    Answer j).

    z>=0

    z is non-negative or not a neutral.

    Answer k).

    x%2==0

    x is an even.

    Answer l).

    Math. abs (x - y) < Math. abs (z - y)

    x is the closer value to variable y than the variable z.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Translate each of the following English statements into logical tests that could be used in an if/else statement. Write the appropriate ...” 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