Skip to content

Instantly share code, notes, and snippets.

@invatainfo
Created August 25, 2017 08:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save invatainfo/573d3247b1962880b475b0644afdd03a to your computer and use it in GitHub Desktop.
Save invatainfo/573d3247b1962880b475b0644afdd03a to your computer and use it in GitHub Desktop.
#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