Home / C / c program for pattern#14

c program for pattern#14

Pattern #14

	1
	01
	101
	0101
	10101

This is a tricky pattern where you have to reduce your coding otherwise it easy using if statement . Can you do it without if statement?

Also see: Alternate Java program for pattern#14

#include<stdio.h>
void main()
{
int i,j,calc;
for(i=1;i<=5;i++)
{
 	for(j=0;j<i;j++)
 	{
	calc=(i+j)%2;
    printf("%d",calc);
	}
 	printf("\n");
}
}

OUTPUT:

pattern#14

Check Also

Restrict Mouse Pointer Position C Graphics Program

This C Program will restrict the Mouse Pointer location or to a particular position or x,y ...

Leave a Reply

Your email address will not be published. Required fields are marked *

Preventing spam * Time limit is exhausted. Please reload the CAPTCHA.