<?xml version="1.0" encoding="windows-1252"?>
<node id="934114" title="Re: asterisk pattern" created="2011-10-27 07:15:53" updated="2011-10-27 07:15:53">
<type id="11">
note</type>
<author id="832495">
choroba</author>
<data>
<field name="doctext">
No explicit loop, just recursion and repetition:&lt;c&gt;
$p=1;sub p{my$x=shift;$x||exit;say" "x(3-$x),"*"x$x;$p=-1if$x&gt;2;p($x+$p)}p 1
&lt;/c&gt;
Update: Not so funny in C:&lt;c&gt;#include&lt;stdio.h&gt;
int p,n;void q(int x){int j;if(!x)return;for(j=1;j&lt;=n-x;j++)printf(" ");for(j=1;j&lt;=x;j++)printf("*");printf("\n");if(x&gt;=n)p=-1;q(x+p);}void main(){printf("Enter the number of columns: ");scanf("%d",&amp;n);p=1;q(1);}
&lt;/c&gt;(I've never really used C, anyway.)</field>
<field name="root_node">
934101</field>
<field name="parent_node">
934101</field>
</data>
</node>
