Last active
March 16, 2016 01:28
-
-
Save ahmedengu/99586d75db13fbb1ee58 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
// Complexity is O(r*c) r : row : column | |
int main() { | |
int j,i,r,c; | |
r=3;c=3; | |
int mat[r][c] = {{1,2,3}, | |
{4,5,6}, | |
{7,8,9}}; | |
for(i=0;i<r;i++){ // r+1 | |
for(j=0;j<c;j++){ // c+1 | |
cout<<mat[j][i]<<" "; // r*c | |
} | |
cout<<endl; // r | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment