Well, you could do it the fun way:
Code:
x=6,_x=7,x_=7;main_(x,_x)
{return(x>0?x_--,main_(x-
printf("%c",_x),_x):x_);}
main(){x>0?main_(main_(x,
32),42),x_+=_x+=1,printf
("%c",'\n'),--x,main():0;}
Or the boring way:
Code:
int main ( void )
{
int lines, i, spaces, fills = 1;
printf ( "Enter the number of lines to print: " );
scanf ( "%d", &lines );
for ( spaces = lines; spaces > 0; spaces--, fills+=2 ) {
for ( i = 0; i < spaces; i++ ) putchar ( ' ' );
for ( i = 0; i < fills; i++ ) putchar ( '*' );
for ( i = 0; i < spaces; i++ ) putchar ( ' ' );
putchar ( '\n' );
}
return 0;
}
>I know its a very odd but a good question
I'm sure it was good the first time it was asked. But this is a standard homework question, so we see it a lot. On the plus side, I've come up with a great many ways to do it over the years.
-Prelude