Monday , December 18 2017
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

Also See:   Program for Merge Sort in C

Check Also

How to Solve Linear Equation in One Variable In C Programming?

C Program to Solve any Linear Equation in One Variable Find complete C program to ...

Leave a Reply

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