What is the output of the following code? [code]q=0;for i=(1:1) q=q+5; end[/code]

What is the output of the following code?
Code:
q=0;for i=(1:1)
q=q+5;
end
A. Output is suppressed
B. Syntactical error
C. q=5
D. Declaration error
 
Answer: a
Explanation: The output is suppressed due to the semi-colon after q=q+5. The output of the following code would’ve only been q=5 if the output was not suppressed. There is no error in the above code.
 

Tìm kiếm

Back
Top