Advertisement
Guest User

Untitled

a guest
Sep 21st, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #include <fstream>
  2. using namespace std;
  3.  
  4. ifstream fin("chenar.in");
  5. ofstream fout("chenar.out");
  6.  
  7. int n, i, j, a[25][25];
  8.  
  9. int main() {
  10. fin >> n;
  11. for (i = 1; i <= n; ++i)
  12. for (j = 1; j <= n; ++j)
  13. fin >> a[i][j];
  14.  
  15. j = 1;
  16. while (j <= n) {
  17. fout << a[1][j] << " ";
  18. ++j;
  19. }
  20.  
  21. i = 2;
  22. while (i <= n) {
  23. fout << a[i][n] << " ";
  24. ++i;
  25. }
  26.  
  27. j = n - 1;
  28. while (j >= 1) {
  29. fout << a[n][j] << " ";
  30. --j;
  31. }
  32.  
  33. i = n - 1;
  34. while (i > 1) {
  35. fout << a[i][1] << " ";
  36. --i;
  37. }
  38.  
  39. return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement