Created
August 25, 2017 08:21
-
-
Save invatainfo/573d3247b1962880b475b0644afdd03a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() { | |
int n,i,j; | |
float m[51][50]; | |
cin>>n; | |
for (i = 0; i < n; i++) | |
for (j = 0; j < n; j++) | |
cin>>m[i][j]; | |
for (i = 0; i < n; i++) { | |
float suma = 0; | |
for (j = 0; j < n; j++) | |
suma += m[j][i]; | |
for (j = n; j > n/2; j--) | |
m[j][i] = m[j - 1][i]; | |
m[n/2][i] = suma/n; | |
} | |
for (i = 0; i < n + 1; i++) { | |
for (j = 0; j < n; j++) | |
cout<<m[i][j]<<" "; | |
cout<<'\n'; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment