Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. /******************************************************************************
  2.  
  3. Welcome to GDB Online.
  4. GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
  5. Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
  6. Code, Compile, Run and Debug online from anywhere in world.
  7.  
  8. *******************************************************************************/
  9. #include <stdio.h>
  10. #include <unistd.h>
  11.  
  12. void rush(int x, int y)
  13. {
  14. int i;
  15. int j;
  16.  
  17. j = 0;
  18. while (j < y)
  19. {
  20. i = 0;
  21. while (i < x)
  22. {
  23. if(!((j == 0) || (j == y-1))) // if not first and last line
  24. {
  25. if (!((i == 0) || (i == x - 1))) // if not first and last column
  26. {
  27. write (1, " ", 1); //empty space
  28. i++;
  29. }
  30. else // first and last column
  31. {
  32. write (1, "B", 1);
  33. i++;
  34. }
  35. }
  36. else if (j == 0) //first and last line
  37. {
  38. if (!((i == 0) || (i == x - 1))) //if not first and last column
  39. write (1, "B", 1);
  40. else
  41. write (1, "A", 1);
  42. i++;
  43. }
  44. else
  45. {
  46. if (!((i == 0) || (i == x - 1))) //if not first and last column
  47. write (1, "B", 1);
  48. else
  49. write (1, "C", 1);
  50. i++;
  51. }
  52. }
  53. write (1, "\n", 1);
  54. j++;
  55. }
  56. }
  57.  
  58. int main()
  59. {
  60. rush(8,8);
  61. return 0;
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement