hi,
i want to get EXEC Pattern 10
ie.,
Output:
1
1 0 1
1 0 1 0 1
1 0 1 0 1 0 1
1 0 1 0 1 0 1 0 1
1 0 1 0 1 0 1 0 1 0 1
1 0 1 0 1 0 1 0 1 0 1 0 1
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
1 0 1 0 1 0 1 0 1 0 1 0 1
1 0 1 0 1 0 1 0 1 0 1
1 0 1 0 1 0 1 0 1
1 0 1 0 1 0 1
1 0 1 0 1
1 0 1
1
i written the following code
declare
@x int,@y int
select
@x=10,@y=0
while
@x>0
begin
print
space(@x)+replicate('1',@y)+replicate('1',@y+1)
set
@y=@y+1
set
@x=@x-1
end
select
@x=0,@y=9
while
@y>0
begin
print
space(@x+2)+replicate('1',@y)+replicate('1',@y-1)
set
@y=@y-1
set
@x=@x+1
end
output as:
1
111
11111
1111111
111111111
11111111111
1111111111111
111111111111111
11111111111111111
1111111111111111111
11111111111111111
111111111111111
1111111111111
11111111111
111111111
1111111
11111
111
1