Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <cmath>
- using namespace std;
- int a[25][25];
- int main ()
- {
- int i,j,n,c=0;
- float s=0,m;
- cin>>n;
- for (i=1;i<=n;i++)
- {
- for (j=1;j<=n;j++)
- {
- cin>>a[i][j];
- }
- }
- for (i=1;i<=n;i++)
- {
- for (j=1;j<=n;j++)
- {
- if (i<j)
- {
- if (a[i][j]>0)
- {
- s=s+a[i][j];
- c++;
- }
- }
- }
- }
- m=1.00*s/c;
- cout<<setprecision(2)<<fixed<<floor(m*100)/100;
- return 0;
- }
- /*
- -1 2 -4 5
- 0 6 3 1
- 2 4 2 0
- 3 -5 1 -3
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement