Program to output below pattern?
1: #include <stdio.h>
2: void main(void)
3: {
4: int i,j;
5: for(i = 1 ; i < 5 ; i++)
6: {
7: for(j = 1 ; j <= i ; j++)
8: {
9: if((j % 2) == 0)
10: printf("1 ");
11: else
12: printf("0 ");
13: }
14: printf("\n");
15: }
16: }
Output:
No comments:
Post a Comment