Advertisement
Guest User

Untitled

a guest
Oct 19th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. #658
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int n,m,a[100][100],s,i,j;
  9. cin>>n>>m;
  10. for(i=0;i<n;i++)
  11. for(j=0;j<m;j++)
  12. cin>>a[i][j];
  13. for(i=0;i<n;i++){
  14. {s=0;
  15. for(j=0;j<m;j++)
  16. s=s+a[i][j];
  17. cout<<s<<" ";}}
  18. return 0;
  19. }
  20.  
  21.  
  22.  
  23.  
  24. #210
  25. #include <iostream>
  26. #include <fstream>
  27. using namespace std;
  28. ifstream fin("chenar.in");
  29. ofstream fout("chenar.out");
  30. int main()
  31. {
  32. int n,j,i,a[101][101];
  33. fin>>n;
  34. for(i=1;i<=n;i++)
  35. for(j=1;j<=n;j++)
  36. fin>>a[i][j];
  37. for(j=1;j<=n;j++)
  38. fout<<a[1][j]<<" ";
  39. for(i=2;i<=n;i++)
  40. fout<<a[i][n]<<" ";
  41. for(j=n-1;j>=1;j--)
  42. fout<<a[n][j]<<" ";
  43. for(i=n-1;i>=2;i--)
  44. fout<<a[i][1]<<" ";
  45.  
  46. fin.close();
  47. fout.close();
  48. return 0;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement