CODE ::
#include <stdio.h>
int main ()
{
int i,j,k,flag=0,n;
printf("N = ");
scanf("%d",&n);
for(i=1,j=n;i<=n,j>0;j--,i=i+2)
{
for(k=1;k<j;k++)
{
printf("\t");
}
for(k=1;k<=i;k++)
{
if(flag==0)
{
printf("0");
flag=1;
if(k!=i)
printf("\t");
}
else
{
printf("1");
flag=0;
if(k!=i)
printf("\t");
}
}
flag=1;
printf("\n\n");
}
}
No comments:
Post a Comment