Advertisement
a53

Inserare1

a53
Jan 6th, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int n;
  7. cin>>n;
  8. float a[51][50],s[50]; /// Matricea si sumele pe coloane
  9. for(int i=0;i<n;++i) /// Citesc matricea
  10. for(int j=0;j<n;++j)
  11. cin>>a[i][j];
  12. for(int j=0;j<n;++j) /// Calculez suma elementelor pe coloane
  13. for(int i=0;i<n;++i)
  14. s[j]+=a[i][j];
  15. for(int i=0;i<n/2;++i) /// Afisez prmele n/2 linii
  16. {
  17. for(int j=0;j<n;++j)
  18. cout<<a[i][j]<<' ';
  19. cout<<'\n';
  20. }
  21. for(int j=0;j<n;++j) /// Afisez linia adaugata cu mediile aritmetice
  22. cout<<s[j]/n<<' ';
  23. cout<<'\n';
  24. for(int i=n/2;i<n;++i) /// Afisez ultimele n/2 linii
  25. {
  26. for(int j=0;j<n;++j)
  27. cout<<a[i][j]<<' ';
  28. cout<<'\n';
  29. }
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement