I need to get this out put but i am noit getting please help me...... i need its coding
1
01
101
0101
10101
010101
1010101
What i have write it is ............... ......
#include<stdio. h>
#include<conio. h>
void main ()
{
int i,j,limit=10,n= 1;
for(i=1;i<=limi t;i=i+2)
{
for(j=1;j<=i;j+ +)
{
if(n==1)
{
printf("%d",n);
n=0;
}
else
{
printf("%d",n);
n=1;
}
}
printf("\n\n");
}
getch();
clrscr();
}
output of this
1
010
10101
0101010
101010101
but i need this
1
01
101
0101
10101
010101
1010101
1
01
101
0101
10101
010101
1010101
What i have write it is ............... ......
#include<stdio. h>
#include<conio. h>
void main ()
{
int i,j,limit=10,n= 1;
for(i=1;i<=limi t;i=i+2)
{
for(j=1;j<=i;j+ +)
{
if(n==1)
{
printf("%d",n);
n=0;
}
else
{
printf("%d",n);
n=1;
}
}
printf("\n\n");
}
getch();
clrscr();
}
output of this
1
010
10101
0101010
101010101
but i need this
1
01
101
0101
10101
010101
1010101
Comment