Answer:
The code, following up the instructions is given below.
Explanation:
//taking input data which should be a positive number
positive_number = input("Enter a positive number:- ");
//if conditional statement to check if the number input is truly positive
if positive_number < 0 then
//printing message for negative input
disp("You entered a negative number. Please, try again.")
else
//printing message for positive input
disp("The number you had entered is positive")
A = []
//nested for loop for sequential matrix creation
for i = 1:positive_number
for j = 1:positive_number
//if for 2 to n rows creation
if i>1 then
A(i,j) = A(i-1,j)+positive_number
//logic for 1st for of matrix
else
A(i,j) = i*j
end
end
end
//displaying matrix
disp(A)
//writting matrix into editor.dat file
fprintfMat('C:\Users\Maximus\Desktop\editor.dat', A, "%4f");
//closing file
mclose('all')
end