c program to print given number pattern

Write a c program to print given number pattern
1111111
000000
11111
0000
111
00
1


#include <stdio.h>

int main()
{
    int k,j;
    for(j=7;j>=1;j--)
    {
        for(k=1;k<=j;k++)
        {
            printf("%d",j%2);
        }
        printf("\n");
    }
}

Related Posts