Lab1 Ex1
Ex1. A+B problem (2 marks)
Write a MATLAB script that gets two numbers a
and b
from user input and prints the value of a + b
.
Hint: Use the built-in function input()
to get input from the user. The test cases are updated and now using empty prompt should be the correct answer. If you already submitted a version with empty prompt, please send private message to TA Yatian Liu for regrade.
MATLAB has extensive high quality documentation. Make good use of it! Type help input
or doc input
in the command window to learn how to use input()
. The same applies to any built-in function.
Sample Test Case
Input:
-1
5.2
Output:
4.2000
Information
- Difficulty
- 6
- Category
- (None)
- Tags
- (None)
- # Submissions
- 271
- Accepted
- 83
- Accepted Ratio
- 31%
- Uploaded By