How to write code for diagonal matrix with specified input ?
1 view (last 30 days)
For n*n diagonal matrix :
n = input (' enter the order of the matrix : ');
s = input (' enter the value of s : ');
My question is if m = 3 and s = 1 then I should get my matrix as [a11] = 1 and remaining entries 0
if m = 3 and s = 2 then [a11] = 1 , [a22] = 1 and remaining entries o.
please help me out with this :)