What is the output of the following code? [code]sin(pi)~=0 [/code]

Vy Bùi

New member
What is the output of the following code?
Code:
sin(pi)~=0
A. NaN
B. 0
C. 1
D. Error
 
Answer: c
Explanation: sin(pi) is not equal to 0 since pi is represented as a floating point number in MATLAB. If pi was declared as a symbolic variable, the output would’ve been 0.
Output: 1
 

Tìm kiếm

Back
Top