Tuesday, August 23, 2011

Number Pattern7

1
01
101
0101
10101
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
clrscr();
for(i=0;i<5;i++)
{
for(j=i+1;j<=(2*i+1);j++)
{
if(j%2==0)
{
printf("0");
}
else
{
printf("1");
}
}
printf("\n");
}
getch();
}

No comments:

Post a Comment

Feel free to comment......