Skip to content

Instantly share code, notes, and snippets.

@ahmedengu
Last active March 16, 2016 01:28
Show Gist options
  • Save ahmedengu/99586d75db13fbb1ee58 to your computer and use it in GitHub Desktop.
Save ahmedengu/99586d75db13fbb1ee58 to your computer and use it in GitHub Desktop.
#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