Advertisement
Guest User

Untitled

a guest
Nov 15th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1.  
  2. #include "pch.h"
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <time.h>
  6.  
  7.  
  8. int main(int argc, char argv[])
  9. {
  10. int n = 20;
  11.  
  12. char a[20][20];
  13.  
  14. for (int i = 0; i < n*n; ++i)
  15. {
  16. a[i / n][i % n] = 'X';
  17. }
  18.  
  19.  
  20. for (int i = 0; i < n; ++i)
  21. {
  22. if (i < n - n/4)
  23. a[i][n / 3] = '0';
  24.  
  25. }
  26.  
  27. for (int i = 0; i < n; ++i)
  28. {
  29. if (i+1 > n / 3)
  30. a[n/2+n/4][i] = '0';
  31. }
  32.  
  33. for (int i = 0; i < n; ++i)
  34. {
  35. for (int j = 0; j < n; ++j)
  36. {
  37. printf("%c ", a[i][j]);
  38. }
  39. printf("\n");
  40. }
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement