[ create a new paste ] login | about

Link: http://codepad.org/7J8zKcDI    [ raw code | output | fork ]

Nameless - C, pasted on Apr 12:
#include <stdio.h>

#define num 7

int main(void)
{
	int current_row=1, current_col=1, current_sym=1, col_size=num-1, last_col=num+1;
decision:
	if(current_row>num)
		goto end;
	if(current_col==last_col)
	{
		if(((current_col&1)&&(current_row==1))||((!(current_col&1))&&(current_row==num)))
			goto asterisk;
		else
		{
			current_sym=1;
			current_col=1;
			goto newline;
		}
	}
	else if(current_sym%col_size==1)
		goto asterisk;
	else if(((current_row==1)&&(!(current_col&1)))||((current_row==num)&&(current_col&1)))
		goto asterisk;
	else goto space;	
asterisk:
	printf("*");
	++current_sym;
	if(current_sym>col_size)
	{
		++current_col;
		current_sym=1;
	}
	if((current_col==last_col)&&(current_sym==2))
	{
		current_sym=1;
		current_col=1;
		goto newline;
	}
	goto decision;
space:
	printf(" ");
	++current_sym;
	if(current_sym>col_size)
	{
		++current_col;
		current_sym=1;
	}
	if((current_col==last_col)&&(current_sym==2))
	{
		current_sym=1;
		current_col=1;
		goto newline;
	}
	goto decision;
newline:
	printf("\n");
	++current_row;
	goto decision;
end:
	return 0;
}


Output:
1
2
3
4
5
6
7
*     *******     *******     *******     
*     *     *     *     *     *     *     
*     *     *     *     *     *     *     
*     *     *     *     *     *     *     
*     *     *     *     *     *     *     
*     *     *     *     *     *     *     
*******     *******     *******     *******


Create a new paste based on this one


Comments: