Bit printing Pattern using C

#include<stdio.h>

int main()
{
int h,i,j,k=1;

printf("Enter the height");
scanf("%d",&h);


for(i=1;i<=h;i++)
{
 for(j=1;j<=i;j++)
  {
    printf("%d ",k++%2);//1  0  1  0
  }
 printf("\n");
}


}



Comments

Popular posts from this blog

JAVA program to add two distance

Print Pattern using C