Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- static int N = 5;
- int matriz[N][N];
- cout << "Matriz Identidad" << endl;
- for(int i = 0; i < N; i++)
- {
- for(int j = 0; j < N; j++)
- {
- matriz[i][j] = ((i == j) ? 1 : 0);
- cout << matriz[i][j] << " ";
- }
- cout << endl;
- }
- cout << endl << "Matriz Invertida" << endl;
- for(int i = N-1; i >= 0; i--)
- {
- for(int j = 0; j < N; j++)
- {
- matriz[i][j] = ((i == j) ? 1 : 0);
- cout << matriz[i][j] << " ";
- }
- cout << endl;
- }
- cin.get();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement