Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Se citeste o matrice patratica de ordinul n din fisier. Afisati suma numerele pare de sub diagonala secundara, precum si
- numarul lor.
- */
- #include <iostream>
- #include <fstream>
- using namespace std;
- ifstream f("date.in");
- int main()
- {
- int n,a[100][100],i,j,s=0,c=0;
- f>>n;
- for (i=1;i<=n;i++)
- for (j=1;j<=n;j++)
- f>>a[i][j];
- for (i=2;i<=n;i++)
- for (j=n+2-i;j<=n;j++)
- if (a[i][j]%2==0)
- {
- s=s+a[i][j];
- c++;
- }
- cout<<s<<" "<<c;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement