a metreLoop through D gun at timensional array representing . the tool Inc.\" a
ID: 3606474 • Letter: A
Question
a metreLoop through D gun at timensional array representing . the tool Inc." a top three the red, column of a L-D army usung I his (re at a rested lasp) In a front ending top lie while(TRUE) punt at and on a th based not with a a) every center ton b) every at the bar c) every other aun rese han recasts dergy is there ) many front of e) Curion 3 iterichoa it is a trbona cci au omber S test to see Gven any * , ); Count value as welve 5) given a revory here R) (running mats he number of iterations will fe, retens the same It did on the first Call G Request to others from a veri and J print he saw and scal of the army eyArmyExplanation / Answer
Solution:
1)
for(int i=0; i<n; i++) //Loop to iterate through rows and n here is the order of 2D matrix
{
for(int j=0; j<n; j++) //loop through the columns
{
if(i==j)
printf("This is the diagonal element%d", array[i][j]); // Displaying the diagonal in C you can use respective sytax for a //particular language, in canse of any doubt as in the comments
}
}
2)
int k= 3;
for(int i=0; i<n; i++) //Loop to iterate through rows and n here is the order of 2D matrix
{
for(int j=0; j<n; j= j+k) //loop through the columns
{
printf("%d is the element of %dth column",array[i][j], j); // This will do the job
k++;
}
}
More than one question asked, please repost others. I advise you to post in good handwriting or typed question will get the answers very fast.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.