Print Elements of Upper Triangular Matrix (Upper Triangular Matrix के Elements को प्रदर्शित करना) :-
Quetion-
Write an algorithm and flowchart to print the elements of the upper triangular matrix.
Upper Triangular Matrix के Elements को प्रदर्शित करने के लिए Algorithm और Flowchart लिखिए।
Example Input Matrix
0 1 2
-------------
0 | 1 2 3
1 | 4 5 6
2 | 7 8 9
Output (Upper Triangular Matrix)
1 2 3
0 5 6
0 0 9
Solution - Algorithm: Print Elements of Upper Triangular Matrix
Step 1: Start.
Step 2: Input the number of rows R and columns C.
Step 3: Input all matrix elements.
Step 4: Set i = 0.
Step 5: Repeat Steps 6 to 10 while i < R.
Step 6: Set j = 0.
Step 7: Repeat Steps 8 and 9 while j < C.
Step 8: If i ≤ j, display A[i][j]; otherwise display 0.
Step 9: Set j = j + 1.
Step 10: Set i = i + 1.
Step 11: Stop.
Logic / Working (कार्यप्रणाली) -