Write a program to print the left and right diagonal elements of an NXN matrix | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Write a program to print the left and right diagonal elements of an NXN matrix

8th Mar 2018, 2:26 AM
Miss Aleena Ali Khan
Miss Aleena Ali Khan - avatar
3 Answers
+ 12
//for main diagonal from A11 to Ann , 1)make a loop to move in rows .... r 2)make a loop inside that loop ... to move through columns of that row ... c 3)print elements of having condition r==c //for diagonal from last column of 1st record to 1st column of last record 1)//same as above 2)//same as above 3)condition : r+c=N-1
8th Mar 2018, 2:40 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 1
As this is a challenge, I think its better to post it in Sololearn's Lesson Factory as an assignment. https://www.sololearn.com/discuss/1082512/?ref=app
8th Mar 2018, 2:45 AM
cHiRaG GhOsH
cHiRaG GhOsH - avatar
0
Yes, when i suggested something learned they said to get something hard and out of the course. When I did this I was said to get some calculations. At last it came again to give something from learning outcomes. Nothing is selected yet!
8th Mar 2018, 5:33 AM
Harsh Raj
Harsh Raj - avatar