1. Member
Join Date
Feb 2011
Posts
44
Rep Power
0
I dont know how can u do it with only one loop ???? then please show us ur idea how can u do with only one loop ??

2. Member
Join Date
Feb 2011
Posts
44
Rep Power
0
for (int i= 0; i < matrix.length; i++)
for (int j= 0; j < matrix.length; j++) // assume a square matrix
if (i != j && matrix[i][j] != 0) return false;
return true;

what is the if condition for return true ??

3. Senior Member
Join Date
Feb 2011
Location
Georgia, USA
Posts
122
Rep Power
0
Wow, I should have looked up the definition of diagnol matrix and brush on my algebra, I was going by my own made up definition based on how I intrepreted your post. I am really sorry for misleading you. Regards

4. Originally Posted by lulzim
for (int i= 0; i < matrix.length; i++)
for (int j= 0; j < matrix.length; j++) // assume a square matrix
if (i != j && matrix[i][j] != 0) return false;
return true;

what is the if condition for return true ??
That if-statement in the inner loop returns false if an element not on the main diagonal was not equal to zero. Your question doesn't make any sense.

kind regards,

Jos

5. Member
Join Date
Feb 2011
Posts
44
Rep Power
0
if(exp) return true; here expr what could be ??
return false

6. Member
Join Date
Feb 2011
Posts
44
Rep Power
0
My question is how to make an if condition that first return true i mean what is expression within if condition that returns true statement

7. Originally Posted by lulzim
My question is how to make an if condition that first return true i mean what is expression within if condition that returns true statement
Please try again because your question doesn't make any sense (and it is a run-on sentense). b.t.w. there is no condition that returns true; if all the matrix elements are tested the matrix is a diagonal matrix and you can simply return true; no condition needed.

kind regards,

Jos

Page 2 of 2 First 12

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•