Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #define N 5
- int main()
- {
- int i, j, space;
- int toPrint = 1;
- for(i = 0; i < N; i++){
- space = N/2+1;
- if(i%2)space = space-i;
- else space = space-i+1;
- for(j = 0; j < space; j++) printf(" ");
- for(j = 0; j <= i; j++){
- printf("%d ", toPrint);
- toPrint = toPrint > 0 ? 0 : 1;
- }
- printf("\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement