Given two variables A and B, swap their values. You should not assume that you know what the values in A and B are, or even that they’re scalar values.
- Hint: You will need a 3rd, temporary variable
- Test your script with A = [4 5 2] and B = [6 1 7 9]
- Print out the values of A and B before the swap using fprintf.
- Print out the values of A and B after the swap using fprintf.
This question belongs to MATLAB software and discusses about application of MATLAB in mathematics to find out values of two given variables.
Download Full Solution