Well, i cant figure how print to the spaces before the *, this is how it is suppose to look:
*
***
*****
*******
EDIT: dunno how to get it to work but it should be a pascal triangle
and this is what i get
*
***
*****
*******

heres the code:

#include<stdio.h>
void main ()
{
	int a, b, c;
	printf ("Enter the number: ");
	scanf ("%d", &a);
		
		for (b=1; b<=a; b++)
		{			
			for (c=1; c<=(b*2-1); c++) 
				{									
					printf ("*");
				}
			printf ("\n");	
		} 		


	return;
}

Edited 6 Years Ago by Unidennn: n/a

void main ()
{
        int a, b, c;
        printf ("Enter the number: ");
        scanf ("%d", &a);
        for (b=1; b<=a; b++)
        {
                for(c = a-b; c>0; c--)
                {
                        printf(" ");
                }
                for (c=1; c<=(b*2-1); c++)
                {
                        printf ("*");
                }
                printf ("\n");
        }
}

Edited 6 Years Ago by __avd: Added [code] tags. For easy readability, always wrap programming code within posts in [code] (code blocks).

Comments
Please don't just give away solutions, help the poster approach the problem

start quote:

void main ()
{
        int a, b, c;
        printf ("Enter the number: ");
        scanf ("%d", &a);
        for (b=1; b<=a; b++)
        {
                for(c = a-b; c>0; c--)
                {
                        printf(" ");
                }
                for (c=1; c<=(b*2-1); c++)
                {
                        printf ("*");
                }
                printf ("\n");
        }
} 

end quote.

thanks for the help :)

Edited 3 Years Ago by mike_2000_17: Fixed formatting

is this what you mean?

#include <stdio.h>

 int x,y;

 main()
 {
    for ( x = 0; x < 10; x++, printf( "\n" ) )

        for ( y = 0; y < (x*2-1); y++ )

            printf( "X" );

    return 0;
 }
Comments
Man, 185 posts and you're still giving away homework solutions? Get it together, man!
Did you read the comments on the other post?
This article has been dead for over six months. Start a new discussion instead.