Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int Columns = 0;
- printf("How many columns would you like? ");
- scanf("%d", &Columns);
- int Row = 0;
- int Counter = 0;
- while (Row >= 0)
- {
- int i;
- for (i = 0; i < Row; i++) printf(" ");
- printf("x");
- if (Row != Columns / 2)
- {
- for (i = 0; i <= Columns - 2 * (Row + 1) - 1; i++) printf(" ");
- printf("x");
- }
- Counter++;
- if (Counter > Columns / 2) Row--;
- else Row++;
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment