[Programmation] [C language] Program draw a star 5 branchs

/* Program to display a star */
#include <stdio.h>

int x,y,dim;

main()
{

/* Entrer les dimensions de l’etoile */
printf( “Enter dimension of picture (i.e. 10): ” );
scanf( “%d”, &dim );

for ( x = 0; x <= dim; x++, printf( “\n” ) )
for ( y = 0; y <= 2*dim; y++ )
if (((x>=dim/2)&(2*x+y/2<=2*dim)&(x-dim/2<=y/4))|((x+dim>=y)&(x+y>=dim)&(2*x+y/2<=2*dim))|((x+dim>=y)&(x+y>=dim)&(x-dim/2<=y/4))) printf(“X”); else printf(” “);

return 0;
}

Advertisements
  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: