
#include<stdio.h>
void main()
{
int i,c=1,a=1,n;
printf("enter the no of rows");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
if((i&1)==0)
{
for(c=1;c<=i;c++)
if((c&1)==0)
printf("%d ",1);
else
printf("%d ",0);
}
else
{
for(a=1;a<=i;a++)
if((a&1)==0)
printf("%d ",0);
else
printf("%d ",1);
}
printf("\n");
}
}
No comments:
Post a Comment