Pages

Saturday, 13 June 2015

Number Pattern 6

Number Pattern 6

Coding:

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

Output:
Please enter number of lines:5
1
10
101
1010
10101