Which of the following codes is correct? x is a randomly generated number. When x is greater than 4, then the variable y is equal to 3, otherwise it is equal to 4.
A. x = rand; if x > 4, y = 3; end
B. x = rand; if x == 4, y = 4; else y = 3; end
C. x = rand; if x > 4, y = 3; else y = 4; end
D. x = rand; if x > 4, y = 3; else y = 4; end
E. x = rand; if x > 4, y = 4; else y = 3; end