Pattern #19

Example#1: C program to generate pattern 19

#include<stdio.h>
int main()
{
	int n,i,j;
	printf("Enter number of rows:");
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=i;j++)
		{
		 if((i+j)%2==0)
		 printf("1");
		 else
		 printf("0");
	}
		printf("\n");
	}
	return 0;
}

Output:

Facebook Comments

Back to Top