Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /******************************************************************************
- Welcome to GDB Online.
- GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
- Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
- Code, Compile, Run and Debug online from anywhere in world.
- *******************************************************************************/
- #include <stdio.h>
- #include <unistd.h>
- void rush(int x, int y)
- {
- int i;
- int j;
- j = 0;
- while (j < y)
- {
- i = 0;
- while (i < x)
- {
- if(!((j == 0) || (j == y-1))) // if not first and last line
- {
- if (!((i == 0) || (i == x - 1))) // if not first and last column
- {
- write (1, " ", 1); //empty space
- i++;
- }
- else // first and last column
- {
- write (1, "B", 1);
- i++;
- }
- }
- else if (j == 0) //first and last line
- {
- if (!((i == 0) || (i == x - 1))) //if not first and last column
- write (1, "B", 1);
- else
- write (1, "A", 1);
- i++;
- }
- else
- {
- if (!((i == 0) || (i == x - 1))) //if not first and last column
- write (1, "B", 1);
- else
- write (1, "C", 1);
- i++;
- }
- }
- write (1, "\n", 1);
- j++;
- }
- }
- int main()
- {
- rush(8,8);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement