In: Mechanical Engineering
Rewrite the following statements to use only one if statement.
if x < y
if z < 10
w = x*y*z
end
end
rewriting given code using only one 'if' statement
if((x
w=x*y*z
end
Explanation:
if we observe given code.. w value will be updated only if both if statements are true...
so the statement w= x*y*z will be executed only if both 'if' statements are true.. means the conditional expressions in both if statements x
by this way we can replace both if statements with single if statement..
the output is not effected..
the output is not effected..