Feeds
提问
Write a function that swaps two numbers x and y. Example, if x=5 and y=20, then after the function is called the new values of x and y should be x=20 and y=5. Write the code.
x=5 y=20
10 years 前 | 1 个回答 | 0
1
个回答提问
Write a function that creates a matrix m x n in whichthe value of each element of the matrix is the sum of the indices for that cell. So, for example, the value of A(1,1) is 2, A(1,2) is 3, and A(3,6)is 9. Inputs m&n, output matrix A. Write the code
A(1,1)=2 A(1,2)=3 A(3,6)=9
10 years 前 | 0 个回答 | 0
0
个回答提问
Write a function called sum_range that takes two numbers, computes their sum and (a)outputs 1 if their sum is greater than or equal to zero. (b)outputs 0 if their sum is less than zero. Write the code
function sum_range=sum_range i=[-1;-8;-4]; j=[2;3;6]; if i>j A(i,j)=1 end if i<j A(i,j)=0 en...
10 years 前 | 0 个回答 | 0