Skip to content

Instantly share code, notes, and snippets.

@ArthurLoboLobo
Created February 6, 2023 20:10
Show Gist options
  • Save ArthurLoboLobo/3f3761047adbd3ca393b09d45969f89e to your computer and use it in GitHub Desktop.
Save ArthurLoboLobo/3f3761047adbd3ca393b09d45969f89e to your computer and use it in GitHub Desktop.
#include<bits/stdc++.h>
using namespace std;
int main() {
int A[3][3];
//Leio a matriz
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 3; j++) {
scanf("%d",&A[i][j]);
}
}
printf("Diagonal principal: %d",A[0][0]+A[1][1]+A[2][2]);
printf("Diagonal secundaria: %d",A[0][2]+A[1][1]+A[2][0]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment